시험 후 데이터를 유지하고 오류 :전화가 null
Uncaught Error: Call to a member function persist() on null in
public function addNewPostAction()
{
// Create new Post entity..
// $entityManager = $container->get('doctrine.entitymanager.orm_default');
$post = new Post();
$post->setTitle('Top 10+ Books about Zend Framework 3');
$post->setContent('Post body goes here');
$post->setStatus(Post::STATUS_PUBLISHED);
$currentDate = date('Y-m-d H:i:s');
$post->setDateCreated($currentDate);
$this->entityManager->persist($post);
$this->entityManager->flush();
}
UPDATE 얻을 : 오류 : 젠드 \ MVC \ 컨트롤러 \ PluginManager를을 :: 얻을 위의 두 샘플에서
public function addNewPostAction()
{
// Create new Post entity..
// $entityManager = $container->get('doctrine.entitymanager.orm_default');
$post = new Post();
$post->setTitle('Top 10+ Books about Zend Framework 3');
$post->setContent('Post body goes here');
$post->setStatus(Post::STATUS_PUBLISHED);
$currentDate = date('Y-m-d H:i:s');
$dm = $this->get('doctrine.odm.mongodb.document_manager');
$dm->persist($post);
$dm->flush();
}
https://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in- : 당신이 이름 myAwesomePlugin으로 플러그인을 정의하면, 당신은 당신의 행동에 액세스 할 수 있습니다 PHP/12769983 # 12769983 – Sammitch