This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

FOSUSER Bundle with multiple USer + Inheritance

Discuss Symfony 2 bundles here

FOSUSER Bundle with multiple USer + Inheritance

by asouma_djo » Wed Nov 05, 2014 1:34 pm

I use PUGXMulti USer , it is An extension for FOSUserBundle to handle users of different types. Following the documentation STep by Step , I created my Entity USER , and 2 other Entities ( Driver , Client ) extends User

Code: Select all
/**@ORM\Entity
 * @ORM\InheritanceType("JOINED")
 * @ORM\DiscriminatorColumn(name="type", type="string")
 * @ORM\DiscriminatorMap({"user_one" = "Dali/FrontBundle/Driver", "user_two" = "Dali/FrontBundle/Client"})
 *
 */
abstract class User extends BaseUser
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id_user;


Client entity start with :
Code: Select all
* @ORM\Entity
 * @ORM\Table(name="client")
*/
class Client extends User
{
    /**
     * @var string

     */
    private $fnameClient;

I created a FormType for ClientRegistration ,
Code: Select all
class ClientFormType extends AbstractType {

     public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('fnameClient');
        $builder->add('username');
        $builder->add('email');

The problem is when I submit the form , it gave me the error:

Code: Select all
An exception occurred while executing 'SELECT t1.username AS username2, t1.username_canonical AS username_canonical3, .... FROM client t1 WHERE t0.username_canonical = ?' with params ["az"]:

My remarks is why he is trying to do where t0.username_canonical istead of t1.username_canonical
asouma_djo
Junior Member
 
Posts: 1
Joined: Wed Nov 05, 2014 1:27 pm