Link the doctrine of the ORM object and the ODA document of the ODM doctrine and use it in the SonataAdminBundle

I have a user document and an address document. They are linked using the @gedmo \ references doctrine extension. This ratio works great. I can get links to referenceMany and referenceOne.

Now I need to use it in the form of sonataUserBundle so that the user can add multiple addresses for the user. (user in mysql, address in mongodb).

I tried using this in the userAdmin class:

  $formMapper->add('addresses', 'sonata_type_model', array(                    
                'class' => 'Application\Sonata\UserBundle\Document\Address',
                'required' => false,
                'expanded' => true,
                'multiple' => true
            ))

this gives me an error:

No entity manager defined for class Application\Sonata\UserBundle\Document\Address

Please tell me what to do!

+4
source share
1 answer

, ModelManager Admin manager_type, ORM. entityManager.

, . " " Entity. :

$formMapper->add('user', 'entity', array(
                'class'    => 'ApplicationSonataUserBundle:User',
                'label' => 'User'
            ));

document sonata_type_model.

+1

Source: https://habr.com/ru/post/1545960/


All Articles