本文整理汇总了PHP中Oro\Bundle\EntityExtendBundle\Tools\ExtendHelper::getRelationType方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtendHelper::getRelationType方法的具体用法?PHP ExtendHelper::getRelationType怎么用?PHP ExtendHelper::getRelationType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\EntityExtendBundle\Tools\ExtendHelper
的用法示例。
在下文中一共展示了ExtendHelper::getRelationType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildOneToManyRelation
/**
* @param ClassMetadataBuilder $metadataBuilder
* @param FieldConfigId $fieldId
* @param array $relation
* @param string $relationKey
*/
protected function buildOneToManyRelation(ClassMetadataBuilder $metadataBuilder, FieldConfigId $fieldId, array $relation, $relationKey)
{
$targetEntity = $relation['target_entity'];
$cascade = !empty($relation['cascade']) ? $relation['cascade'] : [];
$cascade[] = 'detach';
$builder = $metadataBuilder->createOneToMany($fieldId->getFieldName(), $targetEntity);
if (!empty($relation['target_field_id'])) {
$builder->mappedBy($relation['target_field_id']->getFieldName());
}
foreach ($cascade as $cascadeType) {
$builder->{'cascade' . ucfirst($cascadeType)}();
}
$builder->build();
if (!$relation['owner'] && RelationType::ONE_TO_MANY === ExtendHelper::getRelationType($relationKey) && $this->isDefaultRelationRequired($fieldId)) {
$this->buildDefaultRelation($metadataBuilder, $fieldId, $targetEntity);
}
}
示例2: testGetRelationType
public function testGetRelationType()
{
$this->assertEquals('manyToOne', ExtendHelper::getRelationType('manyToOne|Test\\Entity|Test\\TargetEntity|testField'));
}