本文整理汇总了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)) . ')';
}
}
}
示例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;
}
示例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;
}
示例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);
}