Sam Geeks
Sam Geeks

Reputation: 401

Can we use common (doctrine) orm files in multiple bundles in symfony2 ?

I am new to symfony2. I am developing a web application in which I have two bundles: first one is AdminBundle and second is UserBundle. I am using Doctrine ORM for database. I have multiple tables in which some tables are common to both Bundles.

For now, I have to make ORM files in both the Bundles which are common. Is there any way that I can place these common ORM files in a single place and use in both the Bundles?

Upvotes: 2

Views: 127

Answers (1)

Sethunath K M
Sethunath K M

Reputation: 4761

You can definitely use common Entities and mappings . Just use the right namespace when you are referring to it . From your Admin bundle , you can access the user bundle entities for example , like

$user = new Acme\UserBundle\Entities\User();
$userRepo = $em->getRepository("AcmeUserBundle:User");

Upvotes: 2

Related Questions