Docgine 2.5.4鉴别器问题与postgres camelCased列名:“鉴别器列”“缺少”“使用DQL别名”r“

时间:2016-08-21 07:12:31

标签: postgresql symfony doctrine-orm discriminator multi-table-inheritance

所以我正在使用现有数据库的doctrine多类表继承。当我试图查询它时抛出

  

使用DQL别名“r”,“Entity \ Customer”缺少鉴别器列“customertype”。

当前的实体设置如下:

我有一个抽象类Customer,其中定义了鉴别器列。

<?php
namespace Entity;

use {included all imports}

Entity\Postgres\Customer\CompanyCustomer;

/**
 * Customer
 * @ORM\InheritanceType("JOINED")
 * @ORM\DiscriminatorMap({
 *     1="Entity\Customer\Merchant",
 *     2="Entity\Customer\Affiliate"
 *     })
 * @ORM\Entity(repositoryClass="Repository\CustomerRepository")
 * @ORM\Table(name="public.`Customer`")
 * @ORM\DiscriminatorColumn(name="customerType", type="smallint")
 * @JMS\Discriminator(field="customerType", map = {
 *     1="Entity\Customer\Merchant",
 *     2="Entity\Customer\Affiliate"
 *     })
 * @JMS\ExclusionPolicy("all")
 */
abstract class Customer implements EntityInterface
{

    protected $id;
    more properties...
    and methods...
}

儿童商家类......

<?php

namespace Entity\Customer;

use {included all imports}

/**
 * Merchant
 *
 * @ORM\Table(name="public.`CustomerMerchant`")
 * @ORM\Entity
 */
class Merchant extends Customer
{

}

孩子加盟班级......

namespace Entity\Customer;

use {included all imports}

/**
 * CustomerAffiliate
 *
 * @ORM\Table(name="public.`CustomerAffiliate`")
 * @ORM\Entity
 */
class Affiliate extends Customer
{
}

我知道问题出现在具有camelCased而非引用格式的鉴别器列上,但也许有人遇到了同样的问题并且创建了一个解决方法。

0 个答案:

没有答案