3

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

/**@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 :

* @ORM\Entity
 * @ORM\Table(name="client")
*/
class Client extends User
{
    /**
     * @var string

     */
    private $fnameClient;

I created a FormType for ClientRegistration ,

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:

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

Asmaa
  • 331
  • 1
  • 4
  • 13
  • the query is for selecting user not inserting one so I suppose you have successfully registered a client and you get a problem showing it right ? – zizoujab Nov 05 '14 at 13:37
  • No , FOSUSerbbundle see if username exist in database before inserting – Asmaa Nov 05 '14 at 17:37
  • maybe you have a problem in your entities mapping, execute `php app/console doctrine:mapping:info` to check if every thing is ok. also the sql query is not complete and i think the .... are hiding important information to know the issue. – zizoujab Nov 06 '14 at 12:48

1 Answers1

1

As said here :

FOSUserBundle is not designed to work with entity inheritance (and you should probably avoid it as it is a performance killer for Doctrine as relational databases are bad at storing inheritance)

Yonn Trimoreau
  • 539
  • 7
  • 23