0

I'm trying to implement PUGXMultiUserBundle in a Sylius install.

After following bundle's instructions I'm able to fill the form for register userOne but all I get is:

'Entity class 'UserOne' used in the discriminator map of class 'UserBundle\Entity\User' does not exist.

As explained in bundle's documentation, my User.php:

namespace UserBundle\Entity;

use Doctrine\ORM\Mapping as ORM; 
use FOS\UserBundle\Model\User as BaseUser;

/**
 * @ORM\Entity
 * @ORM\Table(name="sylius_user")  
 * @ORM\InheritanceType("JOINED")  
 * @ORM\DiscriminatorColumn(name="type", type="string")  
 * @ORM\DiscriminatorMap({"userOne" = "UserOne", "userTwo" = "UserTwo"}) 
 */
abstract class User extends BaseUser {

/**
 * @ORM\Id
 * @ORM\Column(type="integer")
 * @ORM\GeneratedValue(strategy="AUTO")
 */
protected $id; 
}

And my userOne.php class:

namespace UserBundle\Entity;

use Doctrine\ORM\Mapping as ORM; 
use PUGX\MultiUserBundle\Validator\Constraints\UniqueEntity;

/**  
 * @ORM\Entity  
 * @ORM\Table(name="userOne")  
 * @UniqueEntity(fields = "username", targetClass ="UserBundle\Entity\User", message="fos_user.username.already_used")  
 * @UniqueEntity(fields = "email", targetClass ="UserBundle\Entity\User", message="fos_user.email.already_used")
 */

class UserOne extends User {

/**
 * @ORM\Id
 * @ORM\Column(type="integer")
 * @ORM\GeneratedValue(strategy="AUTO")
 */
protected $id; 
}

I would appreciate any feedback. I can't generate the entities and/or complete the registration due to the same error.

Any help would be really appreciated.

Serge Kvashnin
  • 4,332
  • 4
  • 23
  • 37
indi
  • 63
  • 3
  • 10
  • Your file with `UserOne` class has `UserOne` or `userOne` name? File name must be the same as class name. – Serge Kvashnin Sep 09 '14 at 05:24
  • Thanks for your comment: files with classnames are UserOne – indi Sep 09 '14 at 14:52
  • Well, I'm not sure this should be the accepted answer but it works: Changed User.php to * @ORM\DiscriminatorMap({"userOne" = "Mod\UserBundle\Entity\UserOne", "userTwo" = "Mod\UserBundle\Entity\UserTwo"}) -> So include the whole path to the class (in spite ORM docs say this shouldn't be necessary). – indi Sep 09 '14 at 21:36

0 Answers0