我有覆盖文档(mongodb)和generator.yml的问题
父文件:
<php
namespace Acme\DemoBundle\Document;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
/**
* @ODM\Document
*/
class Product
{
/**
* @ODM\ReferenceOne(targetDocument="Badge")
*/
private $badge;
}
子文件:
<php
namespace Acme\TestDemoBundle\Document;
use Acme\DemoBundle\Document\Product as BaseProduct;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
/**
* @ODM\Document
*/
class Product extends BaseProduct
{
/**
* @ODM\String
*/
private $field;
}
当您在覆盖的生成器新模型中指定时出现问题
父生成器:
generator: admingenerator.generator.doctrine_odm
params:
model: Acme\DemoBundle\Document\Product
namespace_prefix: Acme
bundle_name: DemoBundle
i18n_catalog: AcmeDemoBundle
object_actions:
delete: ~
fields:
badge:
label: badge.label
# ......
子生成器:
generator: admingenerator.generator.doctrine_odm
params:
model: Acme\TestDemoBundle\Document\Product
namespace_prefix: Acme
bundle_name: DemoBundle
i18n_catalog: AcmeDemoBundle
object_actions:
delete: ~
fields:
badge:
label: badge.label
field:
label: field.label
# ......
当您在覆盖的生成器新模型中指定时,会出现问题。我设置为新的生成器模型属性Acme\TestDemoBundle\Document\Product
并收到错误“预期关联名称,'徽章'不是关联。”
hasAssociation()
来自数组中元数据检查字段的方法fieldMappings
,但getAssociationTargetClass()
返回表单asociationMappings
数组