user3147180
user3147180

Reputation: 943

How can i group entities in some different folder in symfony

I have the bundle and entities in folder called Entity

However there are 5 entities which i want to put in different folder to group them.

I have many entities so they get mixed up.

Is there any way so that i have put them in folder called Entity2 or something.

But i do want to persist them and use them in other classes.

I dont want to make separate Bundle for that

Upvotes: 0

Views: 255

Answers (1)

coma
coma

Reputation: 16659

Just use namespaces and specify the table name:

<?php

namespace Comakai\MyBundle\Entity\Location;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @ORM\Entity
 * @ORM\Table(name="location_country")
 */
class Country
{

So this entity will be found at src/Comakai/MyBundle/Entity/Location/Country.php

I use to do it all the time!

Upvotes: 3

Related Questions