symfony - Symfony2 Sonata: No Entity Manager in Custom Class -
i'm trying create custom form in sonata-admin , im geting no entity manager defined class school\childbirthbundle\entity\datachapter
my code:
namespace school\childbirthbundle\admin; use sonata\adminbundle\admin\admin; use sonata\adminbundle\form\formmapper; use sonata\adminbundle\datagrid\datagridmapper; use sonata\adminbundle\datagrid\listmapper; use sonata\adminbundle\show\showmapper; use knp\menu\iteminterface menuiteminterface; use school\childbirthbundle\entity\datachapter; class datachapteradmin extends admin { protected function configureshowfields(showmapper $showmapper) { $showmapper ->add('name') ->add('status') ; } sonata.admin.data_chapter: class: school\childbirthbundle\admin\datachapteradmin tags: - { name: sonata.admin, manager_type: orm, group: "content", label: "chapter" } arguments: - ~ - school\childbirthbundle\entity\datachapter - ~ - @doctrine.orm.default_entity_manager calls: - [ settranslationdomain, [schoolchildbirthbundle]]
and entity looks this
namespace school\childbirthbundle\entity; use doctrine\orm\mapping orm; /** * @orm\entity * @orm\table(name="data_chapter") */ class datachapter { /** * @orm\column(type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ protected $id; /** * @orm\column(type="string", length=255) */ protected $name; /** * @orm\column(type="integer", length=1) */ protected $status; /** * @orm\column(type="integer") */ protected $idsubject; }
i dont know im doing wrong
no entity manager defined class school\childbirthbundle\entity\datachapter 500 internal server error - runtimeexception
in vendor/sonata-project/doctrine-orm-admin-bundle/model/modelmanager.php @ line 223 - $em = $this->registry->getmanagerforclass($class); if (!$em) { throw new \runtimeexception(sprintf('no entity manager defined class %s', $class)); } $this->cache[$class] = $em;
Comments
Post a Comment