Esempio n. 1
0
 /**
  * Adds enableFields and deletedClause to the query if necessary
  *
  * @param QuerySettingsInterface $querySettings
  * @param string $tableNameOrAlias The database table name
  * @param array &$statementParts The query parts
  * @return void
  */
 protected function addVisibilityConstraintStatement(QuerySettingsInterface $querySettings, $tableNameOrAlias, array &$statementParts)
 {
     $statement = '';
     $tableName = $this->resolveTableNameAlias($tableNameOrAlias);
     if (is_array($GLOBALS['TCA'][$tableName]['ctrl'])) {
         $ignoreEnableFields = $querySettings->getIgnoreEnableFields();
         $enableFieldsToBeIgnored = $querySettings->getEnableFieldsToBeIgnored();
         $includeDeleted = $querySettings->getIncludeDeleted();
         if ($this->environmentService->isEnvironmentInFrontendMode()) {
             $statement .= $this->getFrontendConstraintStatement($tableNameOrAlias, $ignoreEnableFields, $enableFieldsToBeIgnored, $includeDeleted);
         } else {
             // TYPO3_MODE === 'BE'
             $statement .= $this->getBackendConstraintStatement($tableNameOrAlias, $ignoreEnableFields, $includeDeleted);
         }
         // Remove the prefixing "AND" if any.
         if (!empty($statement)) {
             $statement = strtolower(substr($statement, 1, 3)) === 'and' ? substr($statement, 5) : $statement;
             $statementParts['additionalWhereClause'][$tableNameOrAlias][] = $statement;
         }
     }
 }
Esempio n. 2
0
 /**
  * Adds enableFields and deletedClause to the query if necessary
  *
  * @param \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings
  * @param string $tableName The database table name
  * @param array &$sql The query parts
  * @return void
  * @todo remove after getUidOfAlreadyPersistedValueObject is adjusted, this was moved to queryParser
  */
 protected function addVisibilityConstraintStatement(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings, $tableName, array &$sql)
 {
     $statement = '';
     if (is_array($GLOBALS['TCA'][$tableName]['ctrl'])) {
         $ignoreEnableFields = $querySettings->getIgnoreEnableFields();
         $enableFieldsToBeIgnored = $querySettings->getEnableFieldsToBeIgnored();
         $includeDeleted = $querySettings->getIncludeDeleted();
         if ($this->environmentService->isEnvironmentInFrontendMode()) {
             $statement .= $this->getFrontendConstraintStatement($tableName, $ignoreEnableFields, $enableFieldsToBeIgnored, $includeDeleted);
         } else {
             // TYPO3_MODE === 'BE'
             $statement .= $this->getBackendConstraintStatement($tableName, $ignoreEnableFields, $includeDeleted);
         }
         if (!empty($statement)) {
             $statement = strtolower(substr($statement, 1, 3)) === 'and' ? substr($statement, 5) : $statement;
             $sql['additionalWhereClause'][] = $statement;
         }
     }
 }
Esempio n. 3
0
 /**
  * Adds enableFields and deletedClause to the query if necessary
  *
  * @param QuerySettingsInterface $querySettings
  * @param string $tableName The database table name
  * @param string $tableAlias
  * @return string
  */
 protected function getVisibilityConstraintStatement(QuerySettingsInterface $querySettings, $tableName, $tableAlias)
 {
     $statement = '';
     if (is_array($GLOBALS['TCA'][$tableName]['ctrl'])) {
         $ignoreEnableFields = $querySettings->getIgnoreEnableFields();
         $enableFieldsToBeIgnored = $querySettings->getEnableFieldsToBeIgnored();
         $includeDeleted = $querySettings->getIncludeDeleted();
         if ($this->environmentService->isEnvironmentInFrontendMode()) {
             $statement .= $this->getFrontendConstraintStatement($tableName, $ignoreEnableFields, $enableFieldsToBeIgnored, $includeDeleted);
         } else {
             // TYPO3_MODE === 'BE'
             $statement .= $this->getBackendConstraintStatement($tableName, $ignoreEnableFields, $includeDeleted);
         }
         if (!empty($statement)) {
             $statement = $this->replaceTableNameWithAlias($statement, $tableName, $tableAlias);
             $statement = strtolower(substr($statement, 1, 3)) === 'and' ? substr($statement, 5) : $statement;
         }
     }
     return $statement;
 }