當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。