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


PHP PageRepository::deleteClause方法代码示例

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


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

示例1: enrichWithRelationFields

 /**
  * Resolve relations as defined in TCA and add them to the provided $pageRecord array.
  *
  * @param int $uid Page id
  * @param array $pageRecord Array with page data to add relation data to.
  * @throws \RuntimeException
  * @return array $pageRecord with additional relations
  */
 protected function enrichWithRelationFields($uid, array $pageRecord)
 {
     $pageOverlayFields = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['FE']['pageOverlayFields']);
     foreach ($GLOBALS['TCA']['pages']['columns'] as $column => $configuration) {
         if ($this->columnHasRelationToResolve($configuration)) {
             $configuration = $configuration['config'];
             if ($configuration['MM']) {
                 /** @var $loadDBGroup \TYPO3\CMS\Core\Database\RelationHandler */
                 $loadDBGroup = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\RelationHandler::class);
                 $loadDBGroup->start($pageRecord[$column], isset($configuration['allowed']) ? $configuration['allowed'] : $configuration['foreign_table'], $configuration['MM'], $uid, 'pages', $configuration);
                 $relatedUids = isset($loadDBGroup->tableArray[$configuration['foreign_table']]) ? $loadDBGroup->tableArray[$configuration['foreign_table']] : array();
             } else {
                 $columnIsOverlaid = in_array($column, $pageOverlayFields, true);
                 $table = $configuration['foreign_table'];
                 $field = $configuration['foreign_field'];
                 $whereClauseParts = array($field . ' = ' . (int) ($columnIsOverlaid ? $uid : $pageRecord['uid']));
                 if (isset($configuration['foreign_match_fields']) && is_array($configuration['foreign_match_fields'])) {
                     foreach ($configuration['foreign_match_fields'] as $field => $value) {
                         $whereClauseParts[] = $field . ' = ' . $this->databaseConnection->fullQuoteStr($value, $table);
                     }
                 }
                 if (isset($configuration['foreign_table_field'])) {
                     if ((int) $this->languageUid > 0 && $columnIsOverlaid) {
                         $whereClauseParts[] = trim($configuration['foreign_table_field']) . ' = \'pages_language_overlay\'';
                     } else {
                         $whereClauseParts[] = trim($configuration['foreign_table_field']) . ' = \'pages\'';
                     }
                 }
                 if (isset($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'])) {
                     $whereClauseParts[] = $table . '.' . $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'] . ' = 0';
                 }
                 $whereClause = implode(' AND ', $whereClauseParts);
                 $whereClause .= $this->pageContext->deleteClause($table);
                 $orderBy = isset($configuration['foreign_sortby']) ? $configuration['foreign_sortby'] : '';
                 $rows = $this->databaseConnection->exec_SELECTgetRows('uid', $table, $whereClause, '', $orderBy);
                 if (!is_array($rows)) {
                     throw new \RuntimeException('Could to resolve related records for page ' . $uid . ' and foreign_table ' . htmlspecialchars($configuration['foreign_table']), 1343589452);
                 }
                 $relatedUids = array();
                 foreach ($rows as $row) {
                     $relatedUids[] = $row['uid'];
                 }
             }
             $pageRecord[$column] = implode(',', $relatedUids);
         }
     }
     return $pageRecord;
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:56,代码来源:RootlineUtility.php

示例2: enrichWithRelationFields

 /**
  * Resolve relations as defined in TCA and add them to the provided $pageRecord array.
  *
  * @param integer $uid Page id
  * @param array $pageRecord Array with page data to add relation data to.
  * @throws \RuntimeException
  * @return array $pageRecord with additional relations
  */
 protected function enrichWithRelationFields($uid, array $pageRecord)
 {
     foreach ($GLOBALS['TCA']['pages']['columns'] as $column => $configuration) {
         if ($this->columnHasRelationToResolve($configuration)) {
             $configuration = $configuration['config'];
             if ($configuration['MM']) {
                 /** @var $loadDBGroup \TYPO3\CMS\Core\Database\RelationHandler */
                 $loadDBGroup = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\RelationHandler');
                 $loadDBGroup->start($pageRecord[$column], $configuration['foreign_table'], $configuration['MM'], $uid, 'pages', $configuration);
                 $relatedUids = $loadDBGroup->tableArray[$configuration['foreign_table']];
             } elseif ($configuration['foreign_field']) {
                 $table = $configuration['foreign_table'];
                 $field = $configuration['foreign_field'];
                 $whereClauseParts = array($field . ' = ' . intval($uid));
                 if (isset($configuration['foreign_match_fields']) && is_array($configuration['foreign_match_fields'])) {
                     foreach ($configuration['foreign_match_fields'] as $field => $value) {
                         $whereClauseParts[] = $field . ' = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($value, $table);
                     }
                 }
                 if (isset($configuration['foreign_table_field'])) {
                     if (intval($this->languageUid) > 0) {
                         $whereClauseParts[] = trim($configuration['foreign_table_field']) . ' = \'pages_language_overlay\'';
                     } else {
                         $whereClauseParts[] = trim($configuration['foreign_table_field']) . ' = \'pages\'';
                     }
                 }
                 $whereClause = implode(' AND ', $whereClauseParts);
                 $whereClause .= $this->pageContext->deleteClause($table);
                 $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', $table, $whereClause);
                 if (!is_array($rows)) {
                     throw new \RuntimeException('Could to resolve related records for page ' . $uid . ' and foreign_table ' . htmlspecialchars($configuration['foreign_table']), 1343589452);
                 }
                 $relatedUids = array();
                 foreach ($rows as $row) {
                     $relatedUids[] = $row['uid'];
                 }
             }
             $pageRecord[$column] = implode(',', $relatedUids);
         }
     }
     return $pageRecord;
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:50,代码来源:RootlineUtility.php


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