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


PHP DatabaseConnection::exec_SELECTgetSingleRow方法代码示例

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


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

示例1: migrateTtNewsCategoryMountsToSysCategoryPerms

 /**
  * Migrate tt_news_categorymounts to category_pems in either be_groups or be_users
  *
  * @param string $table either be_groups or be_users
  */
 public function migrateTtNewsCategoryMountsToSysCategoryPerms($table)
 {
     /** @var \TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler */
     $dataHandler = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
     $dataHandler->admin = TRUE;
     /* assign imported categories to be_groups or be_users */
     $whereClause = 'tt_news_categorymounts != \'\'' . BackendUtility::deleteClause($table);
     $beGroupsOrUsersWithTtNewsCategorymounts = $this->databaseConnection->exec_SELECTgetRows('*', $table, $whereClause);
     $data = array();
     foreach ((array) $beGroupsOrUsersWithTtNewsCategorymounts as $beGroupOrUser) {
         $ttNewsCategoryPermissions = GeneralUtility::trimExplode(',', $beGroupOrUser['tt_news_categorymounts']);
         $sysCategoryPermissions = array();
         foreach ($ttNewsCategoryPermissions as $ttNewsCategoryPermissionUid) {
             $whereClause = 'import_source = \'TT_NEWS_CATEGORY_IMPORT\' AND import_id = ' . $ttNewsCategoryPermissionUid;
             $sysCategory = $this->databaseConnection->exec_SELECTgetSingleRow('uid', 'sys_category', $whereClause);
             if (!empty($sysCategory)) {
                 $sysCategoryPermissions[] = $sysCategory['uid'];
             }
         }
         if (count($sysCategoryPermissions)) {
             $data[$table][$beGroupOrUser['uid']] = array('category_perms' => implode(',', $sysCategoryPermissions) . ',' . $beGroupOrUser['category_perms']);
         }
     }
     $dataHandler->start($data, array());
     $dataHandler->process_datamap();
 }
开发者ID:sr-amueller,项目名称:news_ttnewsimport,代码行数:31,代码来源:TTNewsCategoryImportService.php

示例2: getFormUidFromTtContentUid

 /**
  * Return Form Uid from content element
  *
  * @param int $ttContentUid
  * @return int
  */
 protected function getFormUidFromTtContentUid($ttContentUid)
 {
     $row = $this->databaseConnection->exec_SELECTgetSingleRow('pi_flexform', 'tt_content', 'uid=' . (int) $ttContentUid);
     $flexform = GeneralUtility::xml2array($row['pi_flexform']);
     if (is_array($flexform) && isset($flexform['data']['main']['lDEF']['settings.flexform.main.form']['vDEF'])) {
         return (int) $flexform['data']['main']['lDEF']['settings.flexform.main.form']['vDEF'];
     }
     return 0;
 }
开发者ID:bernhardberger,项目名称:powermail,代码行数:15,代码来源:FieldSelectorUserFunc.php

示例3: registerSession

 /**
  * @param \TYPO3\Sso\Domain\Model\FrontendUser $frontendUser
  *
  * @throws EmptyUserException
  * @return void
  */
 public function registerSession($frontendUser)
 {
     if (!$frontendUser) {
         throw new EmptyUserException('No user given that can be dropped into the session.', 1329749957);
     }
     $row = $this->db->exec_SELECTgetSingleRow('*', 'fe_users', 'uid = ' . $frontendUser->getUid());
     $this->getFeUser()->createUserSession($row);
     $this->getFeUser()->setSessionCookie();
 }
开发者ID:t3dd,项目名称:T3DD16.Backend,代码行数:15,代码来源:AuthenticationService.php

示例4: init

 /**
  * initializes this class
  *
  * @param integer $pageUid
  *
  * @return void
  */
 public function init($pageUid)
 {
     $this->setDatabaseConnection($GLOBALS['TYPO3_DB']);
     if (!$this->layoutSetup instanceof LayoutSetup) {
         if ($pageUid < 0) {
             $triggerElement = $this->databaseConnection->exec_SELECTgetSingleRow('pid', 'tt_content', 'uid = ' . -$pageUid);
             $pageUid = (int) $triggerElement['pid'];
         }
         $this->injectLayoutSetup(GeneralUtility::makeInstance(LayoutSetup::class)->init($pageUid));
     }
 }
开发者ID:stigfaerch,项目名称:gridelements,代码行数:18,代码来源:BackendUtilityGridelements.php

示例5: getRecords

 /**
  * @param int               $startPage
  * @param array             $basePages
  * @param SitemapController $obj
  *
  * @return array
  */
 public function getRecords($startPage, $basePages, SitemapController $obj)
 {
     $nodes = array();
     foreach ($basePages as $uid) {
         if ($this->currentLanguageUid) {
             $fields = $this->cObject->enableFields('pages_language_overlay');
             $overlay = $this->database->exec_SELECTgetSingleRow('uid', 'pages_language_overlay', ' pid=' . intval($uid) . ' AND sys_language_uid=' . $this->currentLanguageUid . $fields);
             if (!is_array($overlay)) {
                 continue;
             }
         }
         // Build URL
         $url = $obj->getUriBuilder()->setTargetPageUid($uid)->build();
         // can't generate a valid url
         if (!strlen($url)) {
             continue;
         }
         // Get Record
         $record = BackendUtility::getRecord('pages', $uid);
         // exclude Doctypes
         if (in_array($record['doktype'], array(4))) {
             continue;
         }
         // Check FE Access
         if ($record['fe_group'] != 0) {
             continue;
         }
         $rootLineList = $GLOBALS['TSFE']->sys_page->getRootLine($record['uid']);
         $addToNode = true;
         foreach ($rootLineList as $rootPage) {
             if ($rootPage['extendToSubpages'] == 1 && $rootPage['fe_group'] != 0) {
                 $addToNode = false;
                 break;
             }
         }
         if ($addToNode == false) {
             continue;
         }
         // Build Node
         $node = new Node();
         $node->setLoc($url);
         $node->setPriority($this->getPriority($startPage, $record));
         $node->setChangefreq(SitemapDataService::mapTimeout2Period($record['cache_timeout']));
         $node->setLastmod($this->getModifiedDate($record));
         #$geo = new Geo();
         #$geo->setFormat('kml');
         #$node->setGeo($geo);
         $nodes[] = $node;
     }
     return $nodes;
 }
开发者ID:rsennert,项目名称:google_services,代码行数:58,代码来源:LanguagePages.php

示例6: normalizeOpenID

 /**
  * Implement normalization according to OpenID 2.0 specification
  * See http://openid.net/specs/openid-authentication-2_0.html#normalization
  *
  * @param string $openIDIdentifier OpenID identifier to normalize
  * @return string Normalized OpenID identifier
  * @throws Exception
  */
 protected function normalizeOpenID($openIDIdentifier)
 {
     if (empty($openIDIdentifier)) {
         throw new Exception('Empty OpenID Identifier given.', 1381922460);
     }
     // Strip everything with and behind the fragment delimiter character "#"
     if (strpos($openIDIdentifier, '#') !== FALSE) {
         $openIDIdentifier = preg_replace('/#.*$/', '', $openIDIdentifier);
     }
     // A URI with a missing scheme is normalized to a http URI
     if (!preg_match('#^https?://#', $openIDIdentifier)) {
         $escapedIdentifier = $this->databaseConnection->quoteStr($openIDIdentifier, $this->authenticationInformation['db_user']['table']);
         $condition = 'tx_openid_openid IN (' . '\'http://' . $escapedIdentifier . '\',' . '\'http://' . $escapedIdentifier . '/\',' . '\'https://' . $escapedIdentifier . '\',' . '\'https://' . $escapedIdentifier . '/\'' . ')';
         $row = $this->databaseConnection->exec_SELECTgetSingleRow('tx_openid_openid', $this->authenticationInformation['db_user']['table'], $condition);
         if (is_array($row)) {
             $openIDIdentifier = $row['tx_openid_openid'];
         } else {
             // This only happens when the OpenID provider will select the final OpenID identity
             // In this case we require a valid URL as we cannot guess the scheme
             // So we throw an Exception and do not start the OpenID handshake at all
             throw new Exception('Trying to authenticate with OpenID but identifier is neither found in a user record nor it is a valid URL.', 1381922465);
         }
     }
     // An empty path component is normalized to a slash
     // (e.g. "http://domain.org" -> "http://domain.org/")
     if (preg_match('#^https?://[^/]+$#', $openIDIdentifier)) {
         $openIDIdentifier .= '/';
     }
     return $openIDIdentifier;
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:38,代码来源:OpenidService.php

示例7: getColumnNames

 /**
  * Get column names
  *
  * @since 1.0.0
  *
  * @param $table
  *
  * @return array
  */
 protected function getColumnNames($table)
 {
     $table = preg_replace('/[^a-z0-9_]/', '', $table);
     if (isset($this->tableColumnCache[$table])) {
         return $this->tableColumnCache[$table];
     } else {
         $result = $this->databaseConnection->exec_SELECTgetSingleRow('*', $table, '1 = 1');
         if ($result) {
             $columnNames = array_keys($result);
             $this->tableColumnCache[$table] = $columnNames;
         } else {
             $columnNames = array();
             $result = $this->databaseConnection->sql_query('SELECT DATABASE();');
             $row = $this->databaseConnection->sql_fetch_row($result);
             $databaseName = $row[0];
             $this->databaseConnection->sql_free_result($result);
             $result = $this->databaseConnection->sql_query("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '" . $databaseName . "' AND TABLE_NAME = '" . $table . "';");
             while ($row = $this->databaseConnection->sql_fetch_row($result)) {
                 $columnNames[] = $row[0];
             }
             $this->databaseConnection->sql_free_result($result);
             $this->tableColumnCache[$table] = $columnNames;
         }
         return $columnNames;
     }
 }
开发者ID:mbrodala,项目名称:t3ext-yaml-configuration,代码行数:35,代码来源:AbstractCommandController.php

示例8: getSingleNewsSettings

 /**
  * Render single news settings
  *
  * @return void
  */
 protected function getSingleNewsSettings()
 {
     $singleNewsRecord = (int) $this->getFieldFromFlexform('settings.singleNews');
     if ($singleNewsRecord > 0) {
         $newsRecord = $this->databaseConnection->exec_SELECTgetSingleRow('*', 'tx_mooxnews_domain_model_news', 'deleted=0 AND uid=' . $singleNewsRecord);
         if (is_array($newsRecord)) {
             $pageRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $newsRecord['pid']);
             if (is_array($pageRecord)) {
                 $iconPage = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $pageRecord, array('title' => 'Uid: ' . $pageRecord['uid']));
                 $iconNews = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('tx_mooxnews_domain_model_news', $newsRecord, array('title' => 'Uid: ' . $newsRecord['uid']));
                 $onClickPage = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconPage, 'pages', $pageRecord['uid'], 1, '', '+info,edit,view', TRUE);
                 $onClickNews = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconNews, 'tx_mooxnews_domain_model_news', $newsRecord['uid'], 1, '', '+info,edit', TRUE);
                 $content = '<a href="#" onclick="' . htmlspecialchars($onClickPage) . '">' . $iconPage . '</a>' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $pageRecord)) . ': ' . '<a href="#" onclick="' . htmlspecialchars($onClickNews) . '">' . $iconNews . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('tx_mooxnews_domain_model_news', $newsRecord)) . '</a>';
             } else {
                 /** @var $message \TYPO3\CMS\Core\Messaging\FlashMessage */
                 $text = sprintf($GLOBALS['LANG']->sL(self::LLPATH . 'pagemodule.pageNotAvailable', TRUE), $newsRecord['pid']);
                 $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $text, '', \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
                 $content = $message->render();
             }
         } else {
             /** @var $message \TYPO3\CMS\Core\Messaging\FlashMessage */
             $text = sprintf($GLOBALS['LANG']->sL(self::LLPATH . 'pagemodule.newsNotAvailable', TRUE), $singleNewsRecord);
             $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $text, '', \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
             $content = $message->render();
         }
         $this->tableData[] = array($GLOBALS['LANG']->sL(self::LLPATH . 'flexforms_general.singleNews'), $content);
     }
 }
开发者ID:preinboth,项目名称:moox_news,代码行数:33,代码来源:CmsLayout.php

示例9: getSingleNewsSettings

 /**
  * Render single news settings
  *
  * @return void
  */
 public function getSingleNewsSettings()
 {
     $singleNewsRecord = (int) $this->getFieldFromFlexform('settings.singleNews');
     if ($singleNewsRecord > 0) {
         $newsRecord = $this->databaseConnection->exec_SELECTgetSingleRow('*', 'tx_news_domain_model_news', 'deleted=0 AND uid=' . $singleNewsRecord);
         if (is_array($newsRecord)) {
             $pageRecord = BackendUtilityCore::getRecord('pages', $newsRecord['pid']);
             if (is_array($pageRecord)) {
                 $iconPage = '<span title="Uid: ' . htmlspecialchars($pageRecord['uid']) . '">' . $this->iconFactory->getIconForRecord('pages', $pageRecord, Icon::SIZE_SMALL)->render() . '</span>';
                 $iconNews = '<span title="Uid: ' . htmlspecialchars($newsRecord['uid']) . '">' . $this->iconFactory->getIconForRecord('tx_news_domain_model_news', $newsRecord, Icon::SIZE_SMALL)->render() . '</span>';
                 $pageTitle = htmlspecialchars(BackendUtilityCore::getRecordTitle('pages', $pageRecord));
                 $newsTitle = BackendUtilityCore::getRecordTitle('tx_news_domain_model_news', $newsRecord);
                 $content = BackendUtilityCore::wrapClickMenuOnIcon($iconPage, 'pages', $pageRecord['uid'], true, '', '+info,edit,view') . $pageTitle . ': ' . BackendUtilityCore::wrapClickMenuOnIcon($iconNews . ' ' . $newsTitle, 'tx_news_domain_model_news', $newsRecord['uid'], true, '', '+info,edit');
             } else {
                 /** @var $message FlashMessage */
                 $text = sprintf($this->getLanguageService()->sL(self::LLPATH . 'pagemodule.pageNotAvailable', true), $newsRecord['pid']);
                 $message = GeneralUtility::makeInstance(FlashMessage::class, $text, '', FlashMessage::WARNING);
                 $content = $message->render();
             }
         } else {
             /** @var $message FlashMessage */
             $text = sprintf($this->getLanguageService()->sL(self::LLPATH . 'pagemodule.newsNotAvailable', true), $singleNewsRecord);
             $message = GeneralUtility::makeInstance(FlashMessage::class, $text, '', FlashMessage::WARNING);
             $content = $message->render();
         }
         $this->tableData[] = [$this->getLanguageService()->sL(self::LLPATH . 'flexforms_general.singleNews'), $content];
     }
 }
开发者ID:mkoitka,项目名称:news,代码行数:33,代码来源:PageLayoutView.php

示例10: performUpdate

 /**
  * Performs the database update.
  *
  * @param array $dbQueries queries done in this update
  * @param mixed $customMessages custom messages
  * @return boolean TRUE on success, FALSE on error
  */
 public function performUpdate(array &$dbQueries, &$customMessages)
 {
     $this->init();
     if (!PATH_site) {
         throw new \Exception('PATH_site was undefined.');
     }
     $fileadminDirectory = rtrim($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '/');
     $targetDirectory = '/_migrated/RTE/';
     $fullTargetDirectory = PATH_site . $fileadminDirectory . $targetDirectory;
     // Create the directory, if necessary
     if (!is_dir($fullTargetDirectory)) {
         \TYPO3\CMS\Core\Utility\GeneralUtility::mkdir_deep($fullTargetDirectory);
     }
     $oldRecords = $this->findMagicImagesInOldLocation();
     foreach ($oldRecords as $refRecord) {
         // Is usually uploads/RTE_magicC_123423324.png.png
         $sourceFileName = $refRecord['ref_string'];
         // Absolute path/filename
         $fullSourceFileName = PATH_site . $refRecord['ref_string'];
         $targetFileName = $targetDirectory . \TYPO3\CMS\Core\Utility\PathUtility::basename($refRecord['ref_string']);
         // Full directory
         $fullTargetFileName = $fullTargetDirectory . \TYPO3\CMS\Core\Utility\PathUtility::basename($refRecord['ref_string']);
         // maybe the file has been moved previously
         if (!file_exists($fullTargetFileName)) {
             // If the source file does not exist, we should just continue, but leave a message in the docs;
             // ideally, the user would be informed after the update as well.
             if (!file_exists(PATH_site . $sourceFileName)) {
                 $this->logger->notice('File ' . $sourceFileName . ' does not exist. Reference was not migrated.', array());
                 $format = 'File \'%s\' does not exist. Referencing field: %s.%d.%s. The reference was not migrated.';
                 $message = sprintf($format, $sourceFileName, $refRecord['tablename'], $refRecord['recuid'], $refRecord['field']);
                 $customMessages .= PHP_EOL . $message;
                 continue;
             }
             rename($fullSourceFileName, $fullTargetFileName);
         }
         // Get the File object
         $file = $this->storage->getFile($targetFileName);
         if ($file instanceof \TYPO3\CMS\Core\Resource\File) {
             // And now update the referencing field
             $targetFieldName = $refRecord['field'];
             $targetRecord = $this->db->exec_SELECTgetSingleRow('uid, ' . $targetFieldName, $refRecord['tablename'], 'uid=' . (int) $refRecord['recuid']);
             if ($targetRecord) {
                 // Replace the old filename with the new one, and add data-* attributes used by the RTE
                 $searchString = 'src="' . $sourceFileName . '"';
                 $replacementString = 'src="' . $fileadminDirectory . $targetFileName . '"';
                 $replacementString .= ' data-htmlarea-file-uid="' . $file->getUid() . '"';
                 $replacementString .= ' data-htmlarea-file-table="sys_file"';
                 $targetRecord[$targetFieldName] = str_replace($searchString, $replacementString, $targetRecord[$targetFieldName]);
                 // Update the record
                 $this->db->exec_UPDATEquery($refRecord['tablename'], 'uid=' . (int) $refRecord['recuid'], array($targetFieldName => $targetRecord[$targetFieldName]));
                 $queries[] = str_replace(LF, ' ', $this->db->debug_lastBuiltQuery);
                 // Finally, update the sys_refindex table as well
                 $this->db->exec_UPDATEquery('sys_refindex', 'hash=' . $this->db->fullQuoteStr($refRecord['hash'], 'sys_refindex'), array('ref_table' => 'sys_file', 'softref_key' => 'rtehtmlarea_images', 'ref_uid' => $file->getUid(), 'ref_string' => $fileadminDirectory . $targetFileName));
                 $queries[] = str_replace(LF, ' ', $this->db->debug_lastBuiltQuery);
             }
         }
     }
     return TRUE;
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:66,代码来源:RteMagicImagesUpdateWizard.php

示例11: addDataThrowsExceptionIfDatabaseFetchingReturnsInvalidRowResultData

 /**
  * @test
  */
 public function addDataThrowsExceptionIfDatabaseFetchingReturnsInvalidRowResultData()
 {
     $input = ['tableName' => 'tt_content', 'command' => 'edit', 'vanillaUid' => 10];
     $this->dbProphecy->quoteStr(Argument::cetera())->willReturn($input['tableName']);
     $this->dbProphecy->exec_SELECTgetSingleRow(Argument::cetera())->willReturn('invalid result data');
     $this->setExpectedException(\UnexpectedValueException::class, '', 1437656323);
     $this->subject->addData($input);
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:11,代码来源:DatabaseEditRowTest.php

示例12: createConfigurationWithoutDomains

 /**
  * Creates configuration for the installation without domain records.
  *
  * @param array $template
  * @return array
  */
 protected function createConfigurationWithoutDomains(array $template)
 {
     $configuration = array('_DEFAULT' => $template);
     $row = $this->databaseConnection->exec_SELECTgetSingleRow('uid', 'pages', 'deleted=0 AND hidden=0 AND is_siteroot=1');
     if (is_array($row) > 0) {
         $configuration['_DEFAULT']['pagePath']['rootpage_id'] = $row['uid'];
     }
     return $configuration;
 }
开发者ID:rvock,项目名称:typo3-realurl,代码行数:15,代码来源:AutomaticConfigurator.php

示例13: addDataSetsParentPageRowOnParentIfCommandIsEdit

 /**
  * @test
  */
 public function addDataSetsParentPageRowOnParentIfCommandIsEdit()
 {
     $input = ['tableName' => 'tt_content', 'command' => 'edit', 'vanillaUid' => 123, 'databaseRow' => ['uid' => 123, 'pid' => 321]];
     $parentPageRow = ['uid' => 321, 'pid' => 456];
     $this->dbProphecy->quoteStr(Argument::cetera())->willReturnArgument(0);
     $this->dbProphecy->exec_SELECTgetSingleRow('*', 'pages', 'uid=321')->willReturn($parentPageRow);
     $result = $this->subject->addData($input);
     $this->assertSame($parentPageRow, $result['parentPageRow']);
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:12,代码来源:DatabaseParentPageRowTest.php

示例14: findOneByOriginalFileAndTaskTypeAndConfiguration

 /**
  * @param \TYPO3\CMS\Core\Resource\File|\TYPO3\CMS\Core\Resource\FileInterface $file
  * @param string $taskType The task that should be executed on the file
  * @param array $configuration
  *
  * @return ProcessedFile
  */
 public function findOneByOriginalFileAndTaskTypeAndConfiguration(FileInterface $file, $taskType, array $configuration)
 {
     $databaseRow = $this->databaseConnection->exec_SELECTgetSingleRow('*', $this->table, 'original=' . (int) $file->getUid() . ' AND task_type=' . $this->databaseConnection->fullQuoteStr($taskType, $this->table) . ' AND configurationsha1=' . $this->databaseConnection->fullQuoteStr(sha1(serialize($configuration)), $this->table));
     if (is_array($databaseRow)) {
         $processedFile = $this->createDomainObject($databaseRow);
     } else {
         $processedFile = $this->createNewProcessedFileObject($file, $taskType, $configuration);
     }
     return $processedFile;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:17,代码来源:ProcessedFileRepository.php

示例15: doLanguageAndWorkspaceOverlay

 /**
  * Performs workspace and language overlay on the given row array. The language and workspace id is automatically
  * detected (depending on FE or BE context). You can also explicitly set the language/workspace id.
  *
  * @param Qom\SourceInterface $source The source (selector od join)
  * @param array $rows
  * @param \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings The TYPO3 CMS specific query settings
  * @param null|int $workspaceUid
  * @return array
  */
 protected function doLanguageAndWorkspaceOverlay(Qom\SourceInterface $source, array $rows, \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings, $workspaceUid = NULL)
 {
     if ($source instanceof Qom\SelectorInterface) {
         $tableName = $source->getSelectorName();
     } elseif ($source instanceof Qom\JoinInterface) {
         $tableName = $source->getRight()->getSelectorName();
     } else {
         // No proper source, so we do not have a table name here
         // we cannot do an overlay and return the original rows instead.
         return $rows;
     }
     $pageRepository = $this->getPageRepository();
     if (is_object($GLOBALS['TSFE'])) {
         if ($workspaceUid !== NULL) {
             $pageRepository->versioningWorkspaceId = $workspaceUid;
         }
     } else {
         if ($workspaceUid === NULL) {
             $workspaceUid = $GLOBALS['BE_USER']->workspace;
         }
         $pageRepository->versioningWorkspaceId = $workspaceUid;
     }
     // Fetches the move-placeholder in case it is supported
     // by the table and if there's only one row in the result set
     // (applying this to all rows does not work, since the sorting
     // order would be destroyed and possible limits not met anymore)
     if (!empty($pageRepository->versioningWorkspaceId) && !empty($GLOBALS['TCA'][$tableName]['ctrl']['versioningWS']) && $GLOBALS['TCA'][$tableName]['ctrl']['versioningWS'] >= 2 && count($rows) === 1) {
         $movePlaceholder = $this->databaseHandle->exec_SELECTgetSingleRow($tableName . '.*', $tableName, 't3ver_state=3 AND t3ver_wsid=' . $pageRepository->versioningWorkspaceId . ' AND t3ver_move_id=' . $rows[0]['uid']);
         if (!empty($movePlaceholder)) {
             $rows = array($movePlaceholder);
         }
     }
     $overlaidRows = array();
     foreach ($rows as $row) {
         // If current row is a translation select its parent
         if (isset($tableName) && isset($GLOBALS['TCA'][$tableName]) && isset($GLOBALS['TCA'][$tableName]['ctrl']['languageField']) && isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']) && !isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerTable'])) {
             if (isset($row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']]) && $row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']] > 0) {
                 $row = $this->databaseHandle->exec_SELECTgetSingleRow($tableName . '.*', $tableName, $tableName . '.uid=' . (int) $row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']] . ' AND ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . '=0');
             }
         }
         $pageRepository->versionOL($tableName, $row, TRUE);
         if ($tableName == 'pages') {
             $row = $pageRepository->getPageOverlay($row, $querySettings->getLanguageUid());
         } elseif (isset($GLOBALS['TCA'][$tableName]['ctrl']['languageField']) && $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] !== '' && !isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerTable'])) {
             if (in_array($row[$GLOBALS['TCA'][$tableName]['ctrl']['languageField']], array(-1, 0))) {
                 $overlayMode = $querySettings->getLanguageMode() === 'strict' ? 'hideNonTranslated' : '';
                 $row = $pageRepository->getRecordOverlay($tableName, $row, $querySettings->getLanguageUid(), $overlayMode);
             }
         }
         if ($row !== NULL && is_array($row)) {
             $overlaidRows[] = $row;
         }
     }
     return $overlaidRows;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:65,代码来源:Typo3DbBackend.php


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