Tomasz Ignatiuk
unread,Apr 2, 2012, 3:34:42 PM4/2/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sonata...@googlegroups.com
Hi guys,
In AdminBundle with Symfony 2.0 I have used a query in admin class in order to get sorted Entities of a foreging obejcts.
protected function configureFormFields(FormMapper $formMapper)
{
$query_odznaczenie = $this->modelManager->getEntityManager()->createQuery('SELECT s FROM MyCompany\MyBundle\Entity\Odznaczenie s ORDER BY s.opis ASC');
$query_tag = $this->modelManager->getEntityManager()->createQuery('SELECT s FROM MyCompany\MyBundle\Entity\Tag s ORDER BY s.nazwa ASC');
$formMapper
->with('Relacje')
->add('odznaczenie', 'sonata_type_model', array('required' => false, 'query' => $query_odznaczenie), array('edit' => 'inline'))
->add('tag', 'sonata_type_model', array('required' => false, 'query' => $query_tag), array('edit' => 'inline'))
->end()
));
}
It worked. But when I have updated to Symfony 2.1 and to dev-master of admin bundle I get this error:
Warning: Missing argument 1 for
Sonata\DoctrineORMAdminBundle\Model\ModelManager::getEntityManager(),
called in
C:\wamp\www\projekt\src\MyCompany\MyBundle\Admin\AutorAdmin.php
on line 57 and defined in
C:\wamp\www\projekt\vendor\sonata-project\doctrine-orm-admin-bundle\Sonata\DoctrineORMAdminBundle\Model\ModelManager.php
line 166