I have a class that extends fos_user class from FOSUserBundle. Every user have some roles. If user has role "BASIC" he has a OneToMany relation with entity Entry (one basic user has many entries). If user has role "MASTER" he has a ManyToMany relation with entity House (many master users have many houses).
I done this:
/**
* @ORM\Entity
*/
class User extends BaseUser
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\ManyToMany(targetEntity="House", inversedBy="users")
*/
protected $houses;
/**
* @ORM\OneToMany(targetEntity="Entry", mappedBy="user")
*/
protected $entries;
}
But it doesn't sound fine.
Is there a design pattern for this scenario?
Aucun commentaire:
Enregistrer un commentaire