[+BUGFIX] Extbase (Persistence): Fixed typo in Exception class.
authorJochen Rau <j.rau@web.de>
Tue, 27 Oct 2009 20:51:03 +0000 (20:51 +0000)
committerJochen Rau <j.rau@web.de>
Tue, 27 Oct 2009 20:51:03 +0000 (20:51 +0000)
[-TASK] Extbase (Persistence): Removed implementation of ArrayObject from Tx_Extbase_Persistence_RowInterface. You have to say $row->getValue('foo') instead of $row['foo'] now. This was necessary to get in sync with FLOW3 again.

typo3/sysext/extbase/Classes/Persistence/Exception/RepositoryException.php
typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapper.php
typo3/sysext/extbase/Classes/Persistence/QueryResult.php
typo3/sysext/extbase/Classes/Persistence/Row.php
typo3/sysext/extbase/Classes/Persistence/RowInterface.php
typo3/sysext/extbase/Classes/Persistence/Storage/Typo3DbBackend.php

index 88725d0..ebf8391 100644 (file)
@@ -34,7 +34,7 @@
  * @version $Id: RepositoryException.php 1811 2009-01-28 12:04:49Z robert $
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  */
-class Tx_Extbase_Persistence_Extbase_RepositoryException extends RuntimeException {
+class Tx_Extbase_Persistence_Exception_RepositoryException extends RuntimeException {
 }
 
 ?>
\ No newline at end of file
index 23e8b03..804b7aa 100644 (file)
@@ -138,8 +138,8 @@ class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton {
         * @return object
         */
        protected function mapSingleRow($className, Tx_Extbase_Persistence_RowInterface $row) {
-               if ($this->identityMap->hasIdentifier($row['uid'], $className)) {
-                       $object = $this->identityMap->getObjectByIdentifier($row['uid'], $className);
+               if ($this->identityMap->hasIdentifier($row->getValue('uid'), $className)) {
+                       $object = $this->identityMap->getObjectByIdentifier($row->getValue('uid'), $className);
                } else {
                        $object = $this->createEmptyObject($className);
                        $this->thawProperties($object, $row);
@@ -175,7 +175,7 @@ class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton {
                $className = get_class($object);
                $dataMap = $this->getDataMap($className);
                $properties = $object->_getProperties();
-               $object->_setProperty('uid', $row['uid']);
+               $object->_setProperty('uid', $row->getValue('uid'));
                foreach ($properties as $propertyName => $propertyValue) {
                        if (!$dataMap->isPersistableProperty($propertyName)) continue;
                        $columnMap = $dataMap->getColumnMap($propertyName);
@@ -188,13 +188,13 @@ class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton {
                                case Tx_Extbase_Persistence_PropertyType::LONG;
                                case Tx_Extbase_Persistence_PropertyType::DOUBLE;
                                case Tx_Extbase_Persistence_PropertyType::BOOLEAN;
-                               if (isset($row[$columnName])) {
-                                       $rawPropertyValue = $row[$columnName];
+                               if ($row->hasValue($columnName)) {
+                                       $rawPropertyValue = $row->getValue($columnName);
                                        $propertyValue = $dataMap->convertFieldValueToPropertyValue($propertyType, $rawPropertyValue);
                                }
                                break;
                                case (Tx_Extbase_Persistence_PropertyType::REFERENCE):
-                                       if (!is_null($row[$columnName])) {
+                                       if (!is_null($row->getValue($columnName))) {
                                                $propertyValue = $this->mapRelatedObjects($object, $propertyName, $row, $columnMap);
                                        } else {
                                                $propertyValue = NULL;
@@ -203,8 +203,8 @@ class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton {
                                        // FIXME we have an object to handle... -> exception
                                default:
                                        // SK: We should throw an exception as this point as there was an undefined propertyType we can not handle.
-                                       if (isset($row[$columnName])) {
-                                               $property = $row[$columnName];
+                                       if ($row->hasValue($columnName)) {
+                                               $property = $row->getValue($columnName);
                                                if (is_object($property)) {
                                                        $propertyValue = $this->mapObject($property);
                                                        // SK: THIS case can not happen I think. At least $this->mapObject() is not available.
@@ -234,7 +234,7 @@ class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton {
                $columnMap = $dataMap->getColumnMap($propertyName);
                $targetClassSchema = $this->reflectionService->getClassSchema(get_class($parentObject));
                $propertyMetaData = $targetClassSchema->getProperty($propertyName);
-               $fieldValue = $row[$columnMap->getColumnName()];
+               $fieldValue = $row->getValue($columnMap->getColumnName());
                if ($columnMap->getLoadingStrategy() === Tx_Extbase_Persistence_Mapper_ColumnMap::STRATEGY_LAZY_PROXY) {
                        $result = t3lib_div::makeInstance('Tx_Extbase_Persistence_LazyLoadingProxy', $parentObject, $propertyName, $fieldValue, $columnMap);
                } else {
index 1c34a4e..f61347a 100644 (file)
@@ -70,7 +70,7 @@ class Tx_Extbase_Persistence_QueryResult implements Tx_Extbase_Persistence_Query
         * @throws Tx_Extbase_Persistence_Exception_RepositoryException if this call is the second time either getRows() or getNodes() has been called on the same QueryResult object or if another error occurs.
        */
        public function getRows() {
-               if ($this->rows === NULL) throw new Tx_Extbase_Persistence_Exception_RepositoryException('Illegal getRows() call - can be called only once and not after getNodes().', 1237991809);
+               if ($this->rows === NULL) throw new Tx_Extbase_Persistence_Exception_RepositoryException('Illegal getRows() call - can be called only once.', 1237991809);
 
                $rowIterator = t3lib_div::makeInstance('Tx_Extbase_Persistence_RowIterator');
                foreach ($this->rows as $row) {
index 7446640..a2212d5 100644 (file)
@@ -63,7 +63,7 @@ class Tx_Extbase_Persistence_Row implements Tx_Extbase_Persistence_RowInterface
         * @return array a Value array.
         */
        public function getValues() {
-               return $this->tuple;
+               return array_values($this->tuple);
        }
 
        /**
index 16bd53b..081dabd 100644 (file)
@@ -32,7 +32,7 @@
  * @subpackage Persistence
  * @version $Id: RowInterface.php 1811 2009-01-28 12:04:49Z robert $
  */
-interface Tx_Extbase_Persistence_RowInterface extends ArrayAccess {
+interface Tx_Extbase_Persistence_RowInterface {
 
        /**
         * @return boolean TRUE if the columnName is set
index c43cc89..6aecfd7 100644 (file)
@@ -172,7 +172,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
         */
        public function getRows(Tx_Extbase_Persistence_QOM_QueryObjectModelInterface $query) {
                $statement = $this->parseQuery($query);
-//             debug($statement, -2); // FIXME remove debug code
+               // debug($statement, -2); // FIXME remove debug code
                $result = $this->databaseHandle->sql_query($statement);
                $this->checkSqlErrors();
                if ($result) {
@@ -235,9 +235,7 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                                $statement .= ' LIMIT ' . $sql['limit'];
                        }
                }
-
                $this->replacePlaceholders($statement, $parameters);
-               // debug($statement,-2);
                return $statement;
        }