In my Symfony2 application, I extracted most of my Entities into a separate library that I install using the composer.
This library is not dependent on Symfony2 (but depends on Doctrine because I use annotations) because I would like to use it in other projects than Symfony2.
The library contains a ClientUser Entity object that maps to the client_users table. In my Symfony2 application, I would like to use the same ClientUser Entity for authentication. This requires me to implement Symfony\Component\Security\Core\User\UserInterface .
The problem is that I would like to have both a "Symfony2-agnostic" and a "Symfony-aware" ClientUser Entity implementation (which should both appear in the same table). I tried extending both classes from the ClientUserAbstract Entity object, but that did not work.
<?php namespace My\Library\Entity; use Doctrine\ORM\Mapping as ORM; class ClientUserAbstract {
My "Symfony2-agnostic" Entity:
<?php namespace My\Library\Entity; use Doctrine\ORM\Mapping as ORM; class ClientUser extends ClientUserAbstract {
My "Symfony2-aware" Entity:
<?php namespace Vendor\Bundle\MyBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Security\Core\User\UserInterface; class ClientUser extends ClientUserAbstract implements UserInterface {
My Symfony 2 now detects two objects that point to the same table and do not work with Exception. I either need to tell my Symfony2 application to βignoreβ my My\Library\Entity\ClientUser , or I need a way to expand it. Any ideas?
source share