【问题标题】:EasyAdminBundle: error add entity with a composite primary keyEasyAdminBundle:使用复合主键添加实体时出错
【发布时间】:2017-07-18 11:22:50
【问题描述】:

我有一个车辆实体,我想用 easyAdmin Bundle 对其进行配置。 我的实体有两个主键:immatriculation 和 user(from entity users : id_user):

 //Vehicule Entity
 /**
 * @ORM\Id
 * @ORM\Column(type="string", name="num_immat")
 */
private $immatriculation;
 /** 
 * @ORM\Id
 * @ORM\ManyToOne(targetEntity="CMN\PortailFretBundle\Entity\User", inversedBy="vehicules")
 * @ORM\JoinColumn(name="id_user", referencedColumnName="id_user")
 */
private $user;

我将我的实体添加到 admin.yml 文件中:

entities:
    Vehicule:
        label: "vehicules"
        class: CMN\PortailFretBundle\Entity\Vehicule
        form:
            fields: ['immatriculation','longueur', 'user']
        edit:
            fields: ['immatriculation','longueur', 'user']
        list:
            fields:
                 - { property: 'immatriculation'}
                 - { property: 'longueur'}

当我尝试查看车辆管理时出现此错误:

Single id is not allowed on composite primary key in entity CMN\PortailFretBundle\Entity\Vehicule

easyAdminBundle 不支持两个主键吗?我该怎么做?

【问题讨论】:

    标签: entity-framework symfony symfony2-easyadmin


    【解决方案1】:

    我在documentation 中发现不支持复合键。

    【讨论】:

      猜你喜欢
      • 2011-12-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多