gpt4 book ai didi

symfony - FOSUSER Bundle with multiple USer + Inheritance

转载 作者:行者123 更新时间:2023-12-04 18:06:01 24 4
gpt4 key购买 nike

我使用 PUGXMulti USer ,它是 FOSUserBundle 的一个扩展来处理不同类型的用户。按照文档 STep by Step ,我创建了我的实体 USER 和其他 2 个实体( Driver , Cl​​ient )扩展了 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;

客户端实体开始于:

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

*/
private $fnameClient;

我为 ClientRegistration 创建了一个 FormType,

class ClientFormType extends AbstractType {

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

问题是当我提交表单时,它给了我错误:

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"]:

我的评论是为什么他试图做 where t0.username_canonical 而不是 t1.username_canonical

最佳答案

如前所述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)

关于symfony - FOSUSER Bundle with multiple USer + Inheritance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26747466/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com