Sylius使用FOS和PUGX MultiUser Bundle,允许通过3种不同的形式,3种不同的角色等注册3个不同的用户。由于Sylius用户被定义为:
- > Sylius \元器件\核心\型号\ user.php的
namespace Sylius\Component\Core\Model;
use FOS\UserBundle\Model\User as BaseUser;
use Sylius\Component\Addressing\Model\AddressInterface;
class User extends BaseUser implements UserInterface{
...
}
由于userOne和userTwo应该扩展一个抽象类,按照PUGX多用户Bundle文档,我们有:
- > Acme公司\ UserBundle \实体\ user.php的
namespace Acme\UserBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\User as BaseUser;
/**
* @ORM\Entity
* @ORM\Table(name="sylius_user_pugx")
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="type", type="string")
* @ORM\DiscriminatorMap({"userone" = "Acme\UserBundle\Entity\userOne", "userTwo" = "Acme\UserBundle\Entity\userTwo", "userThree" = "Acme\UserBundle\Entity\Admin"})
*
*/
abstract class User extends BaseUser {...}
所以现在我们只需要,我们的真正的最终课程:
- > Acme公司\ UserBundle \实体\ userOne.php
namespace Acme\UserBundle\Entity;
use Mod\UserBundle\Entity\User as User;
/**
* @ORM\Entity
* @ORM\Table(name="userOne")
* @UniqueEntity(fields = "username", targetClass = "Acme\UserBundle\Entity\User", message="fos_user.username.already_used")
* @UniqueEntity(fields = "email", targetClass = "Acme\UserBundle\Entity\User", message="fos_user.email.already_used")
*/
class userOne extends User {..}
所以我们正在扩展这种方式:userOne扩展了#Abstract User'延伸' Sylius用户'扩展' FOS用户'。
但我无法更新我的架构:名称为' bbdd.sylius_user_address'已存在
我做错了什么?它不是用户类应该相互扩展的逻辑方式吗?