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

3
  • 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 ? Commented Nov 5, 2014 at 13:37
  • No , FOSUSerbbundle see if username exist in database before inserting Commented Nov 5, 2014 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. Commented Nov 6, 2014 at 12:48

1 Answer 1

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)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.