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


PHP ColumnMap::getRelationTableName方法代码示例

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


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

示例1: setManyToManyRelation

 /**
  * This method sets the configuration for a m:n relation based on
  * the $TCA column configuration
  *
  * @param string|ColumnMap $columnMap The column map
  * @param string $columnConfiguration The column configuration from $TCA
  * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnsupportedRelationException
  * @return ColumnMap
  */
 protected function setManyToManyRelation(ColumnMap $columnMap, $columnConfiguration)
 {
     if (isset($columnConfiguration['MM'])) {
         $columnMap->setTypeOfRelation(ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY);
         $columnMap->setChildTableName($columnConfiguration['foreign_table']);
         $columnMap->setChildTableWhereStatement($columnConfiguration['foreign_table_where']);
         $columnMap->setRelationTableName($columnConfiguration['MM']);
         if (is_array($columnConfiguration['MM_match_fields'])) {
             $columnMap->setRelationTableMatchFields($columnConfiguration['MM_match_fields']);
         }
         if (is_array($columnConfiguration['MM_insert_fields'])) {
             $columnMap->setRelationTableInsertFields($columnConfiguration['MM_insert_fields']);
         }
         $columnMap->setRelationTableWhereStatement($columnConfiguration['MM_table_where']);
         if (!empty($columnConfiguration['MM_opposite_field'])) {
             $columnMap->setParentKeyFieldName('uid_foreign');
             $columnMap->setChildKeyFieldName('uid_local');
             $columnMap->setChildSortByFieldName('sorting_foreign');
         } else {
             $columnMap->setParentKeyFieldName('uid_local');
             $columnMap->setChildKeyFieldName('uid_foreign');
             $columnMap->setChildSortByFieldName('sorting');
         }
     } else {
         throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnsupportedRelationException('The given information to build a many-to-many-relation was not sufficient. Check your TCA definitions. mm-relations with IRRE must have at least a defined "MM" or "foreign_selector".', 1268817963);
     }
     if ($this->getControlSection($columnMap->getRelationTableName()) !== null) {
         $columnMap->setRelationTablePageIdColumnName('pid');
     }
     return $columnMap;
 }
开发者ID:,项目名称:,代码行数:40,代码来源:


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