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


PHP DatabaseConnection::cleanIntArray方法代码示例

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


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

示例1: addPageIdStatement

 /**
  * Builds the page ID checking statement
  *
  * @param string $tableName The database table name
  * @param array &$sql The query parts
  * @param array $storagePageIds list of storage page ids
  * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\InconsistentQuerySettingsException
  * @return void
  */
 protected function addPageIdStatement($tableName, array &$sql, array $storagePageIds)
 {
     $tableColumns = $this->tableColumnCache->get($tableName);
     if ($tableColumns === FALSE) {
         $tableColumns = $this->databaseHandle->admin_get_fields($tableName);
         $this->tableColumnCache->set($tableName, $tableColumns);
     }
     if (is_array($GLOBALS['TCA'][$tableName]['ctrl']) && array_key_exists('pid', $tableColumns)) {
         $rootLevel = (int) $GLOBALS['TCA'][$tableName]['ctrl']['rootLevel'];
         if ($rootLevel) {
             if ($rootLevel === 1) {
                 $sql['additionalWhereClause'][] = $tableName . '.pid = 0';
             }
         } else {
             if (empty($storagePageIds)) {
                 throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\InconsistentQuerySettingsException('Missing storage page ids.', 1365779762);
             }
             $sql['additionalWhereClause'][] = $tableName . '.pid IN (' . implode(',', $this->databaseHandle->cleanIntArray($storagePageIds)) . ')';
         }
     }
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:30,代码来源:Typo3DbQueryParser.php

示例2: getPageIdStatement

 /**
  * Builds the page ID checking statement
  *
  * @param string $tableName The database table name
  * @param string $tableAlias The table alias used in the query.
  * @param array $storagePageIds list of storage page ids
  * @throws InconsistentQuerySettingsException
  * @return string
  */
 protected function getPageIdStatement($tableName, $tableAlias, array $storagePageIds)
 {
     $pageIdStatement = '';
     $tableColumns = $this->tableColumnCache->get($tableName);
     if ($tableColumns === false) {
         $tableColumns = $this->databaseHandle->admin_get_fields($tableName);
         $this->tableColumnCache->set($tableName, $tableColumns);
     }
     if (is_array($GLOBALS['TCA'][$tableName]['ctrl']) && array_key_exists('pid', $tableColumns)) {
         $rootLevel = (int) $GLOBALS['TCA'][$tableName]['ctrl']['rootLevel'];
         switch ($rootLevel) {
             // Only in pid 0
             case 1:
                 return $tableAlias . '.pid = 0';
                 // Pid 0 and pagetree
             // Pid 0 and pagetree
             case -1:
                 if (empty($storagePageIds)) {
                     return $tableAlias . '.pid = 0';
                 }
                 $storagePageIds[] = 0;
                 break;
                 // Only pagetree or not set
             // Only pagetree or not set
             case 0:
                 if (empty($storagePageIds)) {
                     throw new InconsistentQuerySettingsException('Missing storage page ids.', 1365779762);
                 }
                 break;
                 // Invalid configuration
             // Invalid configuration
             default:
                 return '';
         }
         $pageIdStatement = $tableAlias . '.pid IN (' . implode(',', $this->databaseHandle->cleanIntArray($storagePageIds)) . ')';
     }
     return $pageIdStatement;
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:47,代码来源:Typo3DbQueryParser.php

示例3: findAllByUid

 public function findAllByUid($onlyUids = null)
 {
     if ($cache = $this->cacheUtility->getRamCache(__METHOD__, $onlyUids)) {
         return $cache;
     }
     $onlyUidsArr = join(',', \TYPO3\CMS\Core\Database\DatabaseConnection::cleanIntArray($onlyUids));
     $groups_by_uid = $this->feGroupsRepository->findAllByUid();
     $users_by_uid = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows("*", 'fe_users', '1=1 ' . $this->settingsUtility->getEnableFields('fe_users') . ($onlyUids ? ' AND uid IN(' . $onlyUidsArr . ')' : ''), '', '', '', 'uid');
     foreach ($users_by_uid as $k => $item) {
         $ref =& $users_by_uid[$k];
         if ($ref['usergroup'] && ($groups = explode(',', $ref['usergroup']))) {
             $tmp = array();
             foreach ($groups as $uid) {
                 if ($groups_by_uid[$uid]) {
                     $tmp[] =& $groups_by_uid[$uid];
                 }
             }
             $ref['usergroup'] = $tmp;
         }
     }
     $this->cacheUtility->setRamCache($data, __METHOD__, $onlyUids);
     return $users_by_uid;
 }
开发者ID:99grad,项目名称:TYPO3.Extbase.nnfesubmit,代码行数:23,代码来源:FeUserRepository.php

示例4: cleanIntArray

 /**
  * @test
  * @dataProvider cleanIntArrayDataProvider
  * @param array $exampleData The array to sanitize
  * @param array $expectedResult The expected result
  * @return void
  */
 public function cleanIntArray($exampleData, $expectedResult)
 {
     $sanitizedArray = $this->subject->cleanIntArray($exampleData);
     $this->assertEquals($expectedResult, $sanitizedArray);
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:12,代码来源:DatabaseConnectionTest.php


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