[+CONFIGURATION] Extbase (Persistence): Added a new flag respectSysLanguage to the Typoe3QuerySettings (TRUE by default). If it is set to true a "sys_language_uid IN (-1,0)" query part will be added if applicable.
[~TASK] Extbase (Persistence): Refactored getRows() and countRows() to avoid unnecessary calls to doLanguageAndWorkspaceOverlay().
[!!!][+FEATURE] Extbase (Persistence): It's now possible to edit localized domain models in the FE. Changes will be stored to the correct database row. This changes the behavior of mapping the uid to DomainObjects. The uid is now the "real" uid of the localized database tuple instead of the sys_language_parent. This may influence the $_GET parameters of cached pages as the uid is often part of the URI. Resolves #4639.
[~TASK] Extbase (Persistence): Added $query->getQuerySettings()->setRespectSysLanguage(FALSE); to all methods fetching an object "byUid".
[~TASK] Extbase (Persistence): Changed method signatures to Tx_Extbase_DomainObject_DomainObjectInterface instead of Tx_Extbase_DomainObject_AbstractEnty.
+ /**
+ * @var int The uid of the localization parent
+ */
+ protected $_localizationParentUid;
+
/**
* TRUE if the object is a clone
* @var boolean
/**
* TRUE if the object is a clone
* @var boolean
* @return int the uid or NULL if none set yet.
*/
final public function getUid() {
* @return int the uid or NULL if none set yet.
*/
final public function getUid() {
- return ($this->uid === NULL ? NULL : (int)$this->uid);
+ if ($this->uid !== NULL) {
+ return (int)$this->uid;
+ } else {
+ return NULL;
+ }
/**
* Reconstitutes a property. Only for internal use.
*
/**
* Reconstitutes a property. Only for internal use.
*
*/
protected function findObjectByUid($uid) {
$query = $this->queryFactory->create($this->dataType);
*/
protected function findObjectByUid($uid) {
$query = $this->queryFactory->create($this->dataType);
+ $query->getQuerySettings()->setRespectSysLanguage(FALSE);
$result = $query->matching($query->withUid($uid))->execute();
$object = NULL;
if (count($result) > 0) {
$result = $query->matching($query->withUid($uid))->execute();
$object = NULL;
if (count($result) > 0) {
protected function updateObject(Tx_Extbase_DomainObject_DomainObjectInterface $object, array &$row) {
$tableName = $this->dataMapper->getDataMap(get_class($object))->getTableName();
$this->addCommonFieldsToRow($object, $row);
protected function updateObject(Tx_Extbase_DomainObject_DomainObjectInterface $object, array &$row) {
$tableName = $this->dataMapper->getDataMap(get_class($object))->getTableName();
$this->addCommonFieldsToRow($object, $row);
- $uid = $object->getUid();
- $row['uid'] = $uid;
+ $row['uid'] = $object->getUid();
$res = $this->storageBackend->updateRow(
$tableName,
$row
$res = $this->storageBackend->updateRow(
$tableName,
$row
/**
* Returns a table row to be inserted or updated in the database
*
/**
* Returns a table row to be inserted or updated in the database
*
* @var mixed
*/
private $fieldValue;
* @var mixed
*/
private $fieldValue;
/**
* Constructs this proxy instance.
*
/**
* Constructs this proxy instance.
*
// it's parent... the result would be weird.
if ($this->parentObject->_getProperty($this->propertyName) instanceof Tx_Extbase_Persistence_LazyLoadingProxy) {
$dataMapper = Tx_Extbase_Dispatcher::getPersistenceManager()->getBackend()->getDataMapper();
// it's parent... the result would be weird.
if ($this->parentObject->_getProperty($this->propertyName) instanceof Tx_Extbase_Persistence_LazyLoadingProxy) {
$dataMapper = Tx_Extbase_Dispatcher::getPersistenceManager()->getBackend()->getDataMapper();
- $objects = $dataMapper->fetchRelated($this->parentObject, $this->propertyName, $this->fieldValue, FALSE);
+ $objects = $dataMapper->fetchRelated($this->parentObject, $this->propertyName, $this->fieldValue, FALSE, FALSE);
$propertyValue = $dataMapper->mapResultToPropertyValue($this->parentObject, $this->propertyName, $objects);
$this->parentObject->_setProperty($this->propertyName, $propertyValue);
$this->parentObject->_memorizeCleanState($this->propertyName);
$propertyValue = $dataMapper->mapResultToPropertyValue($this->parentObject, $this->propertyName, $objects);
$this->parentObject->_setProperty($this->propertyName, $propertyValue);
$this->parentObject->_memorizeCleanState($this->propertyName);
protected function initializeStorage() {
if (!$this->isInitialized) {
$dataMapper = Tx_Extbase_Dispatcher::getPersistenceManager()->getBackend()->getDataMapper();
protected function initializeStorage() {
if (!$this->isInitialized) {
$dataMapper = Tx_Extbase_Dispatcher::getPersistenceManager()->getBackend()->getDataMapper();
- $objects = $dataMapper->fetchRelated($this->parentObject, $this->propertyName, $this->fieldValue, FALSE);
+ $objects = $dataMapper->fetchRelated($this->parentObject, $this->propertyName, $this->fieldValue, FALSE, FALSE);
$storage = array();
foreach ($objects as $object) {
$storage[spl_object_hash($object)] = $object;
$storage = array();
foreach ($objects as $object) {
$storage[spl_object_hash($object)] = $object;
$className = get_class($object);
$dataMap = $this->getDataMap($className);
$properties = $object->_getProperties();
$className = get_class($object);
$dataMap = $this->getDataMap($className);
$properties = $object->_getProperties();
- $object->_setProperty('uid', $row->getValue('uid'));
+ $localizedUid = $row->getValue('_LOCALIZED_UID');
+ if ($localizedUid !== NULL) {
+ $object->_setProperty('uid', $localizedUid);
+ $object->_setProperty('_localizationParentUid', $row->getValue('uid'));
+ } else {
+ $object->_setProperty('uid', $row->getValue('uid'));
+ }
+ unset($properties['uid']);
foreach ($properties as $propertyName => $propertyValue) {
if (!$dataMap->isPersistableProperty($propertyName)) continue;
$columnMap = $dataMap->getColumnMap($propertyName);
foreach ($properties as $propertyName => $propertyValue) {
if (!$dataMap->isPersistableProperty($propertyName)) continue;
$columnMap = $dataMap->getColumnMap($propertyName);
/**
* Fetches a collection of objects related to a property of a parent object
*
/**
* Fetches a collection of objects related to a property of a parent object
*
- * @param Tx_Extbase_DomainObject_AbstractEntity $parentObject The object instance this proxy is part of
+ * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject The object instance this proxy is part of
* @param string $propertyName The name of the proxied property in it's parent
* @param mixed $fieldValue The raw field value.
* @param string $propertyName The name of the proxied property in it's parent
* @param mixed $fieldValue The raw field value.
- * @param Tx_Extbase_Persistence_Mapper_DataMap $dataMap The corresponding Data Map of the property
+ * @param bool $enableLazyLoading A flag indication if the related objects should be lazy loaded
+ * @param bool $performLanguageOverlay A flag indication if the related objects should be localized
* @return mixed The result
*/
* @return mixed The result
*/
- public function fetchRelated(Tx_Extbase_DomainObject_AbstractEntity $parentObject, $propertyName, $fieldValue = '', $enableLazyLoading = TRUE) {
+ public function fetchRelated(Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName, $fieldValue = '', $enableLazyLoading = TRUE, $performLanguageOverlay = TRUE) {
$columnMap = $this->getDataMap(get_class($parentObject))->getColumnMap($propertyName);
$propertyMetaData = $this->reflectionService->getClassSchema(get_class($parentObject))->getProperty($propertyName);
if ($enableLazyLoading === TRUE && ($propertyMetaData['lazy'] || ($columnMap->getLoadingStrategy() !== Tx_Extbase_Persistence_Mapper_ColumnMap::STRATEGY_EAGER))) {
$columnMap = $this->getDataMap(get_class($parentObject))->getColumnMap($propertyName);
$propertyMetaData = $this->reflectionService->getClassSchema(get_class($parentObject))->getProperty($propertyName);
if ($enableLazyLoading === TRUE && ($propertyMetaData['lazy'] || ($columnMap->getLoadingStrategy() !== Tx_Extbase_Persistence_Mapper_ColumnMap::STRATEGY_EAGER))) {
$result = t3lib_div::makeInstance('Tx_Extbase_Persistence_LazyLoadingProxy', $parentObject, $propertyName, $fieldValue);
}
} else {
$result = t3lib_div::makeInstance('Tx_Extbase_Persistence_LazyLoadingProxy', $parentObject, $propertyName, $fieldValue);
}
} else {
- $result = $this->fetchRelatedEager($parentObject, $propertyName, $fieldValue);
+ $result = $this->fetchRelatedEager($parentObject, $propertyName, $fieldValue, $performLanguageOverlay);
/**
* Fetches the related objects from the storage backend.
*
/**
* Fetches the related objects from the storage backend.
*
- * @param Tx_Extbase_DomainObject_AbstractEntity $parentObject The object instance this proxy is part of
+ * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject The object instance this proxy is part of
* @param string $propertyName The name of the proxied property in it's parent
* @param mixed $fieldValue The raw field value.
* @param string $propertyName The name of the proxied property in it's parent
* @param mixed $fieldValue The raw field value.
+ * @param bool $performLanguageOverlay A flag indication if the related objects should be localized
- protected function fetchRelatedEager(Tx_Extbase_DomainObject_AbstractEntity $parentObject, $propertyName, $fieldValue = '') {
+ protected function fetchRelatedEager(Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName, $fieldValue = '', $performLanguageOverlay = TRUE) {
if ($fieldValue === '') return array();
$query = $this->getPreparedQuery($parentObject, $propertyName, $fieldValue);
if ($fieldValue === '') return array();
$query = $this->getPreparedQuery($parentObject, $propertyName, $fieldValue);
+ $query->getQuerySettings()->setRespectSysLanguage($performLanguageOverlay);
return $query->execute();
}
/**
* Builds and returns the prepared query, ready to be executed.
*
return $query->execute();
}
/**
* Builds and returns the prepared query, ready to be executed.
*
- * @param Tx_Extbase_DomainObject_AbstractEntity $parentObject
+ * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject
* @param string $propertyName
* @param string $fieldValue
* @return void
*/
* @param string $propertyName
* @param string $fieldValue
* @return void
*/
- protected function getPreparedQuery(Tx_Extbase_DomainObject_AbstractEntity $parentObject, $propertyName, $fieldValue = '') {
+ protected function getPreparedQuery(Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName, $fieldValue = '') {
$columnMap = $this->getDataMap(get_class($parentObject))->getColumnMap($propertyName);
$queryFactory = t3lib_div::makeInstance('Tx_Extbase_Persistence_QueryFactory');
$parentKeyFieldName = $columnMap->getParentKeyFieldName();
$columnMap = $this->getDataMap(get_class($parentObject))->getColumnMap($propertyName);
$queryFactory = t3lib_div::makeInstance('Tx_Extbase_Persistence_QueryFactory');
$parentKeyFieldName = $columnMap->getParentKeyFieldName();
* @param array $propertyMetaData The property meta data
* @return void
*/
* @param array $propertyMetaData The property meta data
* @return void
*/
- public function mapResultToPropertyValue(Tx_Extbase_DomainObject_AbstractEntity $parentObject, $propertyName, $result) {
+ public function mapResultToPropertyValue(Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName, $result) {
if ($result instanceof Tx_Extbase_Persistence_LoadingStrategyInterface) {
$propertyValue = $result;
} else {
if ($result instanceof Tx_Extbase_Persistence_LoadingStrategyInterface) {
$propertyValue = $result;
} else {
/**
* Counts the number of related objects assigned to a property of a parent object
*
/**
* Counts the number of related objects assigned to a property of a parent object
*
- * @param Tx_Extbase_DomainObject_AbstractEntity $parentObject The object instance this proxy is part of
+ * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject The object instance this proxy is part of
* @param string $propertyName The name of the proxied property in it's parent
* @param mixed $fieldValue The raw field value.
*/
* @param string $propertyName The name of the proxied property in it's parent
* @param mixed $fieldValue The raw field value.
*/
- public function countRelated(Tx_Extbase_DomainObject_AbstractEntity $parentObject, $propertyName, $fieldValue = '') {
+ public function countRelated(Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName, $fieldValue = '') {
$query = $this->getPreparedQuery($parentObject, $propertyName, $fieldValue);
return $query->count();
}
$query = $this->getPreparedQuery($parentObject, $propertyName, $fieldValue);
return $query->count();
}
/**
* Returns the type of a child object.
*
/**
* Returns the type of a child object.
*
- * @param Tx_Extbase_DomainObject_AbstractEntity $parentObject The object instance this proxy is part of
+ * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject The object instance this proxy is part of
* @param string $propertyName The name of the proxied property in it's parent
* @return string The class name of the child object
*/
* @param string $propertyName The name of the proxied property in it's parent
* @return string The class name of the child object
*/
- protected function getType(Tx_Extbase_DomainObject_AbstractEntity $parentObject, $propertyName) {
+ protected function getType(Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName) {
$propertyMetaData = $this->reflectionService->getClassSchema(get_class($parentObject))->getProperty($propertyName);
$columnMap = $this->getDataMap(get_class($parentObject))->getColumnMap($propertyName);
$childClassName = $columnMap->getChildClassName();
$propertyMetaData = $this->reflectionService->getClassSchema(get_class($parentObject))->getProperty($propertyName);
$columnMap = $this->getDataMap(get_class($parentObject))->getColumnMap($propertyName);
$childClassName = $columnMap->getChildClassName();
/**
* Returns the type of the elements inside an ObjectStorage or array.
*
/**
* Returns the type of the elements inside an ObjectStorage or array.
*
- * @param Tx_Extbase_DomainObject_AbstractEntity $parentObject The object instance this proxy is part of
+ * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject The object instance this proxy is part of
* @param string $propertyName The name of the proxied property in it's parent
* @return string The class name of the elements inside an ObjectStorage
*/
* @param string $propertyName The name of the proxied property in it's parent
* @return string The class name of the elements inside an ObjectStorage
*/
- protected function getElementType(Tx_Extbase_DomainObject_AbstractEntity $parentObject, $propertyName) {
+ protected function getElementType(Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName) {
$propertyMetaData = $this->reflectionService->getClassSchema(get_class($parentObject))->getProperty($propertyName);
$columnMap = $this->getDataMap(get_class($parentObject))->getColumnMap($propertyName);
$childClassName = $columnMap->getChildClassName();
$propertyMetaData = $this->reflectionService->getClassSchema(get_class($parentObject))->getProperty($propertyName);
$columnMap = $this->getDataMap(get_class($parentObject))->getColumnMap($propertyName);
$childClassName = $columnMap->getChildClassName();
$object = $this->identityMap->getObjectByIdentifier($uid, $this->objectType);
} else {
$query = $this->createQuery();
$object = $this->identityMap->getObjectByIdentifier($uid, $this->objectType);
} else {
$query = $this->createQuery();
+ $query->getQuerySettings()->setRespectSysLanguage(FALSE);
$result = $query->matching($query->withUid($uid))->execute();
$object = NULL;
if (count($result) > 0) {
$result = $query->matching($query->withUid($uid))->execute();
$object = NULL;
if (count($result) > 0) {
// debug($statement,-2);
$result = $this->databaseHandle->sql_query($statement);
$this->checkSqlErrors();
// debug($statement,-2);
$result = $this->databaseHandle->sql_query($statement);
$this->checkSqlErrors();
- return $this->getRowsFromResult($query->getSource(), $result);
+ $rows = $this->getRowsFromResult($query->getSource(), $result);
+ $rows = $this->doLanguageAndWorkspaceOverlay($query->getSource(), $rows);
+ return $rows;
$this->replacePlaceholders($statement, $parameters);
$result = $this->databaseHandle->sql_query($statement);
$this->checkSqlErrors();
$this->replacePlaceholders($statement, $parameters);
$result = $this->databaseHandle->sql_query($statement);
$this->checkSqlErrors();
- $tuples = $this->getRowsFromResult($query->getSource(), $result);
- return current(current($tuples));
+ $rows = $this->getRowsFromResult($query->getSource(), $result);
+ return current(current($rows));
if ($querySettings->getRespectEnableFields()) {
$this->addEnableFieldsStatement($tableName, $sql);
}
if ($querySettings->getRespectEnableFields()) {
$this->addEnableFieldsStatement($tableName, $sql);
}
+ if ($querySettings->getRespectSysLanguage()) {
+ $this->addSysLanguageStatement($tableName, $sql);
+ }
if ($querySettings->getRespectStoragePage()) {
$this->addPageIdStatement($tableName, $sql);
}
if ($querySettings->getRespectStoragePage()) {
$this->addPageIdStatement($tableName, $sql);
}
$this->addEnableFieldsStatement($leftTableName, $sql);
$this->addEnableFieldsStatement($rightTableName, $sql);
}
$this->addEnableFieldsStatement($leftTableName, $sql);
$this->addEnableFieldsStatement($rightTableName, $sql);
}
+ if ($querySettings->getRespectSysLanguage()) {
+ $this->addSysLanguageStatement($leftTableName, $sql);
+ $this->addSysLanguageStatement($rightTableName, $sql);
+ }
if ($querySettings->getRespectStoragePage()) {
$this->addPageIdStatement($leftTableName, $sql);
$this->addPageIdStatement($rightTableName, $sql);
if ($querySettings->getRespectStoragePage()) {
$this->addPageIdStatement($leftTableName, $sql);
$this->addPageIdStatement($rightTableName, $sql);
+
+ /**
+ * Builds the language field statement
+ *
+ * @param string $tableName The database table name
+ * @param array &$sql The query parts
+ * @return void
+ */
+ protected function addSysLanguageStatement($tableName, array &$sql) {
+ if (is_array($GLOBALS['TCA'][$tableName]['ctrl'])) {
+ if(isset($GLOBALS['TCA'][$tableName]['ctrl']['languageField']) && $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] !== NULL) {
+ $sql['additionalWhereClause'][] = $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . ' IN (0,-1)';
+ }
+ }
+ }
+
/**
* Builds the page ID checking statement
*
/**
* Builds the page ID checking statement
*
- * Transforms a Resource from a database query to an array of rows. Performs the language and
- * workspace overlay before.
+ * Transforms a Resource from a database query to an array of rows.
*
* @param Tx_Extbase_Persistence_QOM_SourceInterface $source The source (selector od join)
* @param resource $result The result
*
* @param Tx_Extbase_Persistence_QOM_SourceInterface $source The source (selector od join)
* @param resource $result The result
protected function getRowsFromResult(Tx_Extbase_Persistence_QOM_SourceInterface $source, $result) {
$rows = array();
while ($row = $this->databaseHandle->sql_fetch_assoc($result)) {
protected function getRowsFromResult(Tx_Extbase_Persistence_QOM_SourceInterface $source, $result) {
$rows = array();
while ($row = $this->databaseHandle->sql_fetch_assoc($result)) {
- if ($source instanceof Tx_Extbase_Persistence_QOM_SelectorInterface) {
- $row = $this->doLanguageAndWorkspaceOverlay($source->getSelectorName(), $row);
- } else if ($source instanceof Tx_Extbase_Persistence_QOM_JoinInterface) {
- $row = $this->doLanguageAndWorkspaceOverlay($source->getLeft()->getSelectorName(), $row);
- }
if (is_array($row)) {
// TODO Check if this is necessary, maybe the last line is enough
if (is_array($row)) {
// TODO Check if this is necessary, maybe the last line is enough
- $arrayKeys = range(0,count($row));
+ $arrayKeys = range(0, count($row));
array_fill_keys($arrayKeys, $row);
$rows[] = $row;
}
array_fill_keys($arrayKeys, $row);
$rows[] = $row;
}
* 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.
*
* 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 Tx_Extbase_Persistence_Mapper_DataMap $dataMap
+ * @param Tx_Extbase_Persistence_QOM_SourceInterface $source The source (selector od join)
* @param array $row The row array (as reference)
* @param string $languageUid The language id
* @param string $workspaceUidUid The workspace id
* @return void
*/
* @param array $row The row array (as reference)
* @param string $languageUid The language id
* @param string $workspaceUidUid The workspace id
* @return void
*/
- protected function doLanguageAndWorkspaceOverlay($tableName, array $row, $languageUid = NULL, $workspaceUid = NULL) {
- if (!($this->pageSelectObject instanceof t3lib_pageSelect)) {
- if (TYPO3_MODE == 'FE') {
- if (is_object($GLOBALS['TSFE'])) {
- $this->pageSelectObject = $GLOBALS['TSFE']->sys_page;
+ protected function doLanguageAndWorkspaceOverlay(Tx_Extbase_Persistence_QOM_SourceInterface $source, array $rows, $languageUid = NULL, $workspaceUid = NULL) {
+ $overlayedRows = array();
+ foreach ($rows as $row) {
+ if (!($this->pageSelectObject instanceof t3lib_pageSelect)) {
+ if (TYPO3_MODE == 'FE') {
+ if (is_object($GLOBALS['TSFE'])) {
+ $this->pageSelectObject = $GLOBALS['TSFE']->sys_page;
+ } else {
+ require_once(PATH_t3lib . 'class.t3lib_page.php');
+ $this->pageSelectObject = t3lib_div::makeInstance('t3lib_pageSelect');
+ }
} else {
require_once(PATH_t3lib . 'class.t3lib_page.php');
} else {
require_once(PATH_t3lib . 'class.t3lib_page.php');
- $this->pageSelectObject = t3lib_div::makeInstance('t3lib_pageSelect');
+ $this->pageSelectObject = t3lib_div::makeInstance( 't3lib_pageSelect' );
- } else {
- require_once(PATH_t3lib . 'class.t3lib_page.php');
- $this->pageSelectObject = t3lib_div::makeInstance( 't3lib_pageSelect' );
- }
- }
- if (is_object($GLOBALS['TSFE'])) {
- if ($languageUid === NULL) {
- $languageUid = $GLOBALS['TSFE']->sys_language_uid;
- if ($workspaceUid !== NULL) {
+ if (is_object($GLOBALS['TSFE'])) {
+ if ($languageUid === NULL) {
+ $languageUid = $GLOBALS['TSFE']->sys_language_uid;
+ }
+ if ($workspaceUid !== NULL) {
+ $this->pageSelectObject->versioningWorkspaceId = $workspaceUid;
+ }
+ } else {
+ if ($languageUid === NULL) {
+ $languageUid = intval(t3lib_div::_GP('L'));
+ }
+ if ($workspaceUid === NULL) {
+ $workspaceUid = $GLOBALS['BE_USER']->workspace;
+ }
$this->pageSelectObject->versioningWorkspaceId = $workspaceUid;
}
$this->pageSelectObject->versioningWorkspaceId = $workspaceUid;
}
- } else {
- if ($languageUid === NULL) {
- $languageUid = intval(t3lib_div::_GP('L'));
+ if ($source instanceof Tx_Extbase_Persistence_QOM_SelectorInterface) {
+ $tableName = $source->getSelectorName();
+ } elseif ($source instanceof Tx_Extbase_Persistence_QOM_JoinInterface) {
+ $tableName = $source->getLeft()->getSelectorName();
- if ($workspaceUid === NULL) {
- $workspaceUid = $GLOBALS['BE_USER']->workspace;
+ $this->pageSelectObject->versionOL($tableName, $row, TRUE);
+ if(isset($GLOBALS['TCA'][$tableName]['ctrl']['languageField']) && $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] !== '') {
+ if (in_array($row[$GLOBALS['TCA'][$tableName]['ctrl']['languageField']], array(-1,0))) {
+ $row = $this->pageSelectObject->getRecordOverlay($tableName, $row, $languageUid);
+ }
- $this->pageSelectObject->versioningWorkspaceId = $workspaceUid;
+ $overlayedRows[] = $row;
- $this->pageSelectObject->versionOL($tableName, $row, TRUE);
- $row = $this->pageSelectObject->getRecordOverlay($tableName, $row, $languageUid, ''); //'hideNonTranslated'
- // TODO Skip if empty languageoverlay (languagevisibility)
- return $row;
*/
protected $respectEnableFields = TRUE;
*/
protected $respectEnableFields = TRUE;
+ /**
+ * Flag if the sys_language_uid should be respected (default is TRUE).
+ * @var boolean
+ */
+ protected $respectSysLanguage = TRUE;
+
/**
* Flag if the the query result should be returned as raw QueryResult.
* @var boolean
/**
* Flag if the the query result should be returned as raw QueryResult.
* @var boolean
return $this->respectStoragePage;
}
return $this->respectStoragePage;
}
+ /**
+ * Sets the flag if a and language overlay should be performed.
+ *
+ * @param $respectEnableFields TRUE if a and language overlay should be performed.
+ * @return $this (fluent interface)
+ * @api
+ */
+ public function setRespectSysLanguage($respectSysLanguage) {
+ $this->respectSysLanguage = $respectSysLanguage;
+ return $this;
+ }
+
+ /**
+ * Returns the state, if a and language overlay should be performed.
+ *
+ * @return boolean TRUE, if a and language overlay should be performed; otherwise FALSE.
+ */
+ public function getRespectSysLanguage() {
+ return $this->respectSysLanguage;
+ }
+
/**
* Sets the flag if the visibility in the frontend should be respected.
*
/**
* Sets the flag if the visibility in the frontend should be respected.
*
*/
public function setRespectEnableFields($respectEnableFields);
*/
public function setRespectEnableFields($respectEnableFields);
+ /**
+ * Sets the flag if if the sys language should be respected.
+ *
+ * @param $respectSysLanguage TRUE if the sys language should be respected.
+ * @return $this (fluent interface)
+ * @api
+ */
+ public function setRespectSysLanguage($respectSysLanguage);
+
+ /**
+ * Returns the state, if the sys language should be respected.
+ *
+ * @return boolean TRUE, if the sys language should be respected; otherwise FALSE.
+ */
+ public function getRespectSysLanguage();
+
+
/**
* Sets the state, if the QueryResult should be returned unmapped.
*
* @return boolean TRUE, if the QueryResult should be returned unmapped; otherwise FALSE.
/**
* Sets the state, if the QueryResult should be returned unmapped.
*
* @return boolean TRUE, if the QueryResult should be returned unmapped; otherwise FALSE.
*/
public function setReturnRawQueryResult($returnRawQueryResult);
*/
public function setReturnRawQueryResult($returnRawQueryResult);
* Returns the state, if the QueryResult should be returned unmapped.
*
* @return boolean TRUE, if the QueryResult should be returned unmapped; otherwise FALSE.
* Returns the state, if the QueryResult should be returned unmapped.
*
* @return boolean TRUE, if the QueryResult should be returned unmapped; otherwise FALSE.
*/
public function getReturnRawQueryResult();
*/
public function getReturnRawQueryResult();
*/
protected function findObjectByUid($dataType, $uid) {
$query = $this->queryFactory->create($dataType);
*/
protected function findObjectByUid($dataType, $uid) {
$query = $this->queryFactory->create($dataType);
+ $query->getQuerySettings()->setRespectSysLanguage(FALSE);
$result = $query->matching($query->withUid($uid))->execute();
$object = NULL;
if (count($result) > 0) {
$result = $query->matching($query->withUid($uid))->execute();
$object = NULL;
if (count($result) > 0) {