[!!!][+BUGFIX] Extbase (Persistence): All methods trying to find an object by uid...
authorJochen Rau <j.rau@web.de>
Thu, 1 Jul 2010 18:35:11 +0000 (18:35 +0000)
committerJochen Rau <j.rau@web.de>
Thu, 1 Jul 2010 18:35:11 +0000 (18:35 +0000)
typo3/sysext/extbase/Classes/MVC/Controller/Argument.php
typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapper.php
typo3/sysext/extbase/Classes/Persistence/Repository.php
typo3/sysext/extbase/Classes/Property/Mapper.php

index 2c96c4b..2370c44 100644 (file)
@@ -378,6 +378,7 @@ class Tx_Extbase_MVC_Controller_Argument {
        protected function findObjectByUid($uid) {
                $query = $this->queryFactory->create($this->dataType);
                $query->getQuerySettings()->setRespectSysLanguage(FALSE);
+               $query->getQuerySettings()->setRespectStoragePage(FALSE);
                $result = $query->matching($query->equals('uid', $uid))->execute();
                $object = NULL;
                if (count($result) > 0) {
index 3ff9e6e..693b9cb 100644 (file)
@@ -343,25 +343,19 @@ class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton {
         */
        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');
                $type = $this->getType(get_class($parentObject), $propertyName);
-               if ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_ONE) {
-                       $query = $queryFactory->create($type);
-               } elseif ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
-                       $query = $queryFactory->create($type);
-                       $query->getQuerySettings()->setRespectStoragePage(FALSE);
+               $queryFactory = t3lib_div::makeInstance('Tx_Extbase_Persistence_QueryFactory');
+               $query = $queryFactory->create($type);
+               $query->getQuerySettings()->setRespectStoragePage(FALSE);
+               if ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
                        if ($columnMap->getChildSortByFieldName() !== NULL) {
                                $query->setOrderings(array($columnMap->getChildSortByFieldName() => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING));
                        }
                } elseif ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
-                       $query = $queryFactory->create($type);
-                       $query->getQuerySettings()->setRespectStoragePage(FALSE);
                        $query->setSource($this->getSource($parentObject, $propertyName));
                        if ($columnMap->getChildSortByFieldName() !== NULL) {
                                $query->setOrderings(array($columnMap->getChildSortByFieldName() => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING));
                        }
-               } else {
-                       throw new Tx_Extbase_Persistence_Exception('Could not determine type of relation for the property "' . $propertyName . '". This is mainly caused by a missing type declaration above the property definition. If the PHPDoc comment is there, make sure it starts with "/**" and not just with "/*".', 1252502725);
                }
                $query->matching($this->getConstraint($query, $parentObject, $propertyName, $fieldValue, $columnMap->getRelationTableMatchFields()));
                return $query;
index 3a5a25c..54dda45 100644 (file)
@@ -246,6 +246,7 @@ class Tx_Extbase_Persistence_Repository implements Tx_Extbase_Persistence_Reposi
                } else {
                        $query = $this->createQuery();
                        $query->getQuerySettings()->setRespectSysLanguage(FALSE);
+                       $query->getQuerySettings()->setRespectStoragePage(FALSE);
                        $result = $query->matching($query->equals('uid', $uid))->execute();
                        $object = NULL;
                        if (count($result) > 0) {
index 64183f6..65204fa 100644 (file)
@@ -317,6 +317,7 @@ class Tx_Extbase_Property_Mapper {
        protected function findObjectByUid($dataType, $uid) {
                $query = $this->queryFactory->create($dataType);
                $query->getQuerySettings()->setRespectSysLanguage(FALSE);
+               $query->getQuerySettings()->setRespectStoragePage(FALSE);
                $result = $query->matching($query->equals('uid', intval($uid)))->execute();
                $object = NULL;
                if (count($result) > 0) {