[TYPO3-mvc] Re: setRespectSysLanguage does not work after upgrade 4.7 to 6.0

Laurent Cherpit lcherpit at ttree.ch
Thu Apr 4 02:31:04 CEST 2013


No clue at this moment.
But it seems that the difference come with the new PropertyMapper. ?

Before diving in the problem, I use the workaround in my repository as:

	/**
	 * initialize object
	 */
	public function initializeObject() {
		$this->defaultQuerySettings = $this->objectManager->create('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings');
		$this->defaultQuerySettings->setRespectStoragePage(FALSE);
		$this->defaultQuerySettings->setRespectSysLanguage(FALSE);
	}

	/**
	 * Storage pid can be forced
	 *
	 * @param array $storagePageIds
	 */
	public function setForceStoragePageIds(array $storagePageIds) {
		$this->defaultQuerySettings->setRespectStoragePage(TRUE);
		$this->defaultQuerySettings->setStoragePageIds($storagePageIds);
	}

And to get to original root Object, i have to be added that also in Persistene\Generic\Backend::getObjectByIdentifier.

	public function getObjectByIdentifier($identifier, $className) {
		if ($this->identityMap->hasIdentifier($identifier, $className)) {
			return $this->identityMap->getObjectByIdentifier($identifier, $className);
		} else {
			$query = $this->queryFactory->create($className);
			$query->getQuerySettings()->setRespectStoragePage(FALSE);
			$query->getQuerySettings()->setRespectSysLanguage(FALSE);
			return $query->matching($query->equals('uid', $identifier))->execute()->getFirst();
		}
	}


Otherwise, if a record is translated, on the call of action of type "show" (SingleView) the getObjectByIdentifier method generates a  "nonsense" query. 
like:

SELECT model.* FROM model
WHERE model.uid = '94'
AND model.deleted=0 AND model.t3ver_state<=0 AND model.pid<>-1 AND model.hidden=0 AND model.starttime<=1365013440 AND (model.endtime=0 OR model.endtime>1365013440) 
AND (model.sys_language_uid IN (1,-1) OR (model.sys_language_uid=0 
AND model.uid NOT IN (
SELECT model.l10n_parent FROM model WHERE model.l10n_parent>0 AND model.sys_language_uid>0 AND model.deleted=0
))) LIMIT 1

In that case, the subquery return a list of uid in which the uid of the first where contraint  "model.uid = '94'" is in it.

if  features.rewrittenPropertyMapper is set to 0, it work. but we can not longer use the typeConverters.

sry for my english ^^
Laurent


More information about the TYPO3-project-typo3v4mvc mailing list