だから私は、既存のデータベースで教義の複数のクラステーブルの継承を扱っていました。クエリを実行しようとすると、スローされます
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...
}
子Merchantクラス...
<?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
{
}
問題がキャメルケースで引用されていない形式の識別子列にあることは知っていますが、おそらく誰かが同じ問題を抱えていて、これを回避する方法を作成しました。