しようとすると、データのメンバ関数へのコール(存続)とエラーが出ます:データベースへのヌル
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: エラー: のZend \ MVC \コントローラ\ PluginManager :: GET上記の2つのサンプルから
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