我使用下一个库:
"gedmo/doctrine-extensions": "2.3.*",
"stof/doctrine-extensions-bundle": "1.1.*"是否可以使gedmo-root字段成为这样的外键:
/**
* @ORM\ManyToOne(targetEntity="SP\EventBundle\Entity\Event")
* @ORM\JoinColumn(name="event_id", referencedColumnName="id", nullable=false)
* @Gedmo\TreeRoot
*/
private $event;我需要另一个领域吗?
发布于 2014-09-05 07:01:30
没有办法去做。您需要为@Gedmo\TreeRoot添加列。
有关更多详细信息,请参阅lib/Gedmo/Tree/Mapping/Driver/Annotation.php
if ($this->reader->getPropertyAnnotation($property, self::ROOT)) {
$field = $property->getName();
if (!$meta->hasField($field)) {
throw new InvalidMappingException("Unable to find 'root' - [{$field}] as mapped property in entity - {$meta->name}");
}
if (!$validator->isValidFieldForRoot($meta, $field)) {
throw new InvalidMappingException("Tree root field - [{$field}] type is not valid and must be any of the 'integer' types or 'string' in class - {$meta->name}");
}
$config['root'] = $field;
}$meta只包含实体的公共字段,而不包含FK!
https://stackoverflow.com/questions/25605610
复制相似问题