当前位置: 首页>>代码示例>>PHP>>正文


PHP ExtendHelper::buildToManyRelationTargetFieldName方法代码示例

本文整理汇总了PHP中Oro\Bundle\EntityExtendBundle\Tools\ExtendHelper::buildToManyRelationTargetFieldName方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtendHelper::buildToManyRelationTargetFieldName方法的具体用法?PHP ExtendHelper::buildToManyRelationTargetFieldName怎么用?PHP ExtendHelper::buildToManyRelationTargetFieldName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Oro\Bundle\EntityExtendBundle\Tools\ExtendHelper的用法示例。


在下文中一共展示了ExtendHelper::buildToManyRelationTargetFieldName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createSelfRelation

 /**
  * @param ConfigInterface $fieldConfig
  */
 protected function createSelfRelation(ConfigInterface $fieldConfig)
 {
     $selfFieldId = $this->createFieldConfigId($fieldConfig);
     $selfIsOwnerSide = true;
     $targetFieldId = false;
     $targetEntityClass = $fieldConfig->get('target_entity');
     if (in_array($selfFieldId->getFieldType(), RelationType::$toManyRelations, true)) {
         $relationFieldName = ExtendHelper::buildToManyRelationTargetFieldName($selfFieldId->getClassName(), $selfFieldId->getFieldName());
         if ($selfFieldId->getFieldType() === RelationType::ONE_TO_MANY) {
             $selfIsOwnerSide = false;
         }
         $targetFieldId = new FieldConfigId('extend', $targetEntityClass, $relationFieldName, ExtendHelper::getReverseRelationType($selfFieldId->getFieldType()));
     }
     $relationKey = $fieldConfig->get('relation_key');
     $selfConfig = $this->getEntityConfig($selfFieldId->getClassName());
     $selfRelation = ['field_id' => $selfFieldId, 'owner' => $selfIsOwnerSide, 'target_entity' => $targetEntityClass, 'target_field_id' => $targetFieldId];
     if ($fieldConfig->has('cascade')) {
         $selfRelation['cascade'] = $fieldConfig->get('cascade');
     }
     $selfRelations = $selfConfig->get('relation', false, []);
     $selfRelations[$relationKey] = $selfRelation;
     $selfConfig->set('relation', $selfRelations);
     $this->configManager->persist($selfConfig);
     $targetConfig = $this->getEntityConfig($targetEntityClass);
     $targetRelation = ['field_id' => $targetFieldId, 'owner' => !$selfIsOwnerSide, 'target_entity' => $selfFieldId->getClassName(), 'target_field_id' => $selfFieldId];
     $targetRelations = $targetConfig->get('relation', false, []);
     $targetRelations[$relationKey] = $targetRelation;
     $targetConfig->set('relation', $targetRelations);
     $this->configManager->persist($targetConfig);
 }
开发者ID:paulstoica,项目名称:platform,代码行数:33,代码来源:RelationEntityConfigDumperExtension.php

示例2: testBuildToManyRelationTargetFieldName

 /**
  * @dataProvider buildToManyRelationTargetFieldNameProvider
  */
 public function testBuildToManyRelationTargetFieldName($entityClassName, $fieldName, $expected)
 {
     $this->assertEquals($expected, ExtendHelper::buildToManyRelationTargetFieldName($entityClassName, $fieldName));
 }
开发者ID:snorchel,项目名称:platform,代码行数:7,代码来源:ExtendHelperTest.php

示例3: generateOneToManyRelationColumnName

 /**
  * Builds a column name for a one-to-many relation
  *
  * @param string $entityClassName
  * @param string $associationName
  * @return string
  */
 public function generateOneToManyRelationColumnName($entityClassName, $associationName)
 {
     return sprintf('%s%s', ExtendHelper::buildToManyRelationTargetFieldName($entityClassName, $associationName), self::RELATION_COLUMN_SUFFIX);
 }
开发者ID:woei66,项目名称:platform,代码行数:11,代码来源:ExtendDbIdentifierNameGenerator.php


注:本文中的Oro\Bundle\EntityExtendBundle\Tools\ExtendHelper::buildToManyRelationTargetFieldName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。