Revert "[BUGFIX] Prevent sql errors with missing ColumnMap"
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Tue, 19 Feb 2013 21:13:33 +0000 (22:13 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Tue, 19 Feb 2013 21:14:31 +0000 (22:14 +0100)
This reverts commit 0b899a43f2512d90c1db1e60f53b365071f7cea3

Change-Id: Iac88987a7022711d5407712eb9dddf6a6f553e71
Reviewed-on: https://review.typo3.org/18387
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
typo3/sysext/extbase/Classes/Persistence/Generic/Exception/MissingColumnMapException.php [deleted file]
typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php

diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/MissingColumnMapException.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/MissingColumnMapException.php
deleted file mode 100644 (file)
index dfa4396..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Persistence\Generic\Exception;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2012 Extbase Team (http://forge.typo3.org/projects/typo3v4-mvc)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * A "Missing ColumnMap" exception
- */
-class MissingColumnMapException extends \TYPO3\CMS\Extbase\Persistence\Generic\Exception {
-
-}
-
-?>
\ No newline at end of file
index 82f70b8..6f11536 100644 (file)
@@ -385,27 +385,19 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
         *
         * @param \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject $object The Value Object
         * @return mixed The matching uid if an object was found, else FALSE
-        *
-        * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\MissingColumnMapException
         */
        public function getUidOfAlreadyPersistedValueObject(\TYPO3\CMS\Extbase\DomainObject\AbstractValueObject $object) {
                $fields = array();
                $parameters = array();
-               $className = get_class($object);
-               $dataMap = $this->dataMapper->getDataMap($className);
-
+               $dataMap = $this->dataMapper->getDataMap(get_class($object));
                $properties = $object->_getProperties();
                foreach ($properties as $propertyName => $propertyValue) {
-                       $columnMap = $dataMap->getColumnMap($propertyName);
-                       if ($columnMap === NULL) {
-                               throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\MissingColumnMapException('The ColumnMap for property "' . $propertyName . '" of class "' . $className . '" is missing.', 1353170711);
-                       }
                        // FIXME We couple the Backend to the Entity implementation (uid, isClone); changes there breaks this method
                        if ($dataMap->isPersistableProperty($propertyName) && $propertyName !== 'uid' && $propertyName !== 'pid' && $propertyName !== 'isClone') {
                                if ($propertyValue === NULL) {
-                                       $fields[] = $columnMap->getColumnName() . ' IS NULL';
+                                       $fields[] = $dataMap->getColumnMap($propertyName)->getColumnName() . ' IS NULL';
                                } else {
-                                       $fields[] = $columnMap->getColumnName() . '=?';
+                                       $fields[] = $dataMap->getColumnMap($propertyName)->getColumnName() . '=?';
                                        $parameters[] = $this->getPlainValue($propertyValue);
                                }
                        }
@@ -558,7 +550,6 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
         * @param array &$sql SQL query parts to add to
         * @param array &$parameters Parameters to bind to the SQL
         * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\RepositoryException
-        * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\MissingColumnMapException
         * @return void
         */
        protected function parseComparison(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface $comparison, \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source, array &$sql, array &$parameters) {
@@ -594,9 +585,6 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
                                $columnName = $this->dataMapper->convertPropertyNameToColumnName($propertyName, $className);
                                $dataMap = $this->dataMapper->getDataMap($className);
                                $columnMap = $dataMap->getColumnMap($propertyName);
-                               if ($columnMap === NULL) {
-                                       throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\MissingColumnMapException('The ColumnMap for property "' . $propertyName . '" of class "' . $className . '" is missing.', 1355142273);
-                               }
                                $typeOfRelation = $columnMap instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap ? $columnMap->getTypeOfRelation() : NULL;
                                if ($typeOfRelation === \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
                                        $relationTableName = $columnMap->getRelationTableName();
@@ -701,7 +689,6 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
         * @param array $sql
         * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception
         * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\InvalidRelationConfigurationException
-        * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\MissingColumnMapException
         */
        protected function addUnionStatement(&$className, &$tableName, &$propertyPath, array &$sql) {
                $explodedPropertyPath = explode('.', $propertyPath, 2);
@@ -709,11 +696,6 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
                $columnName = $this->dataMapper->convertPropertyNameToColumnName($propertyName, $className);
                $tableName = $this->dataMapper->convertClassNameToTableName($className);
                $columnMap = $this->dataMapper->getDataMap($className)->getColumnMap($propertyName);
-
-               if ($columnMap === NULL) {
-                       throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\MissingColumnMapException('The ColumnMap for property "' . $propertyName . '" of class "' . $className . '" is missing.', 1355142232);
-               }
-
                $parentKeyFieldName = $columnMap->getParentKeyFieldName();
                $childTableName = $columnMap->getChildTableName();