From: Anja Leichsenring Date: Tue, 19 Feb 2013 21:13:33 +0000 (+0100) Subject: Revert "[BUGFIX] Prevent sql errors with missing ColumnMap" X-Git-Tag: TYPO3_6-2-0alpha1~21^2~83 X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/d1e7cdd8ab089304b4de0a9e7b9855135111c4a4 Revert "[BUGFIX] Prevent sql errors with missing ColumnMap" This reverts commit 0b899a43f2512d90c1db1e60f53b365071f7cea3 Change-Id: Iac88987a7022711d5407712eb9dddf6a6f553e71 Reviewed-on: https://review.typo3.org/18387 Reviewed-by: Anja Leichsenring Tested-by: Anja Leichsenring --- 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 index dfa43962823e..000000000000 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/Exception/MissingColumnMapException.php +++ /dev/null @@ -1,36 +0,0 @@ - \ No newline at end of file diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php index 82f70b848eba..6f11536e4938 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php @@ -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();