From a0cd82b9bca5f7a5319e4d335a4fff3cd540e48f Mon Sep 17 00:00:00 2001 From: Michael Moravec Date: Sun, 4 Mar 2018 04:13:01 +0100 Subject: [PATCH] Remove dead code leftovers after #7095 --- UPGRADE.md | 6 +- lib/Doctrine/ORM/Mapping/ClassMetadata.php | 90 ------------------- .../Driver/Annotation/AnnotationDriver.php | 39 -------- .../ORM/Mapping/Driver/AnnotationDriver.php | 39 -------- .../Mapping/Driver/NewAnnotationDriver.php | 39 -------- 5 files changed, 5 insertions(+), 208 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index c975c8d6d0b..2966452db6c 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -46,7 +46,11 @@ These methods have been removed: * `Doctrine/ORM/Mapping/ClassMetadata::getNamedNativeQueries()` * `Doctrine/ORM/Mapping/ClassMetadata::addNamedNativeQuery()` * `Doctrine/ORM/Mapping/ClassMetadata::hasNamedNativeQuery()` - + * `Doctrine\ORM\Mapping\ClassMetadata::addSqlResultSetMapping()` + * `Doctrine\ORM\Mapping\ClassMetadata::getSqlResultSetMapping()` + * `Doctrine\ORM\Mapping\ClassMetadata::getSqlResultSetMappings()` + * `Doctrine\ORM\Mapping\ClassMetadata::hasSqlResultSetMapping()` + ## BC Break: Removed support for entity namespace aliases The support for namespace aliases has been removed. diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadata.php b/lib/Doctrine/ORM/Mapping/ClassMetadata.php index 8ced53cc540..e15715c095d 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadata.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadata.php @@ -462,36 +462,6 @@ public function isIdentifierComposite() : bool return isset($this->identifier[1]); } - /** - * Gets the result set mapping. - * - * @see ClassMetadata::$sqlResultSetMappings - * - * @param string $name The result set mapping name. - * - * @return mixed[] - * - * @throws MappingException - */ - public function getSqlResultSetMapping($name) - { - if (! isset($this->sqlResultSetMappings[$name])) { - throw MappingException::resultMappingNotFound($this->className, $name); - } - - return $this->sqlResultSetMappings[$name]; - } - - /** - * Gets all sql result set mappings of the class. - * - * @return mixed[][] - */ - public function getSqlResultSetMappings() - { - return $this->sqlResultSetMappings; - } - /** * Validates & completes the basic mapping information for field mapping. * @@ -1277,56 +1247,6 @@ public function addInheritedProperty(Property $property) } } - /** - * INTERNAL: - * Adds a sql result set mapping to this class. - * - * @param mixed[] $resultMapping - * - * @throws MappingException - */ - public function addSqlResultSetMapping(array $resultMapping) - { - if (! isset($resultMapping['name'])) { - throw MappingException::nameIsMandatoryForSqlResultSetMapping($this->className); - } - - if (isset($this->sqlResultSetMappings[$resultMapping['name']])) { - throw MappingException::duplicateResultSetMapping($this->className, $resultMapping['name']); - } - - if (isset($resultMapping['entities'])) { - foreach ($resultMapping['entities'] as $key => $entityResult) { - if (! isset($entityResult['entityClass'])) { - throw MappingException::missingResultSetMappingEntity($this->className, $resultMapping['name']); - } - - $entityClassName = $entityResult['entityClass']; - $resultMapping['entities'][$key]['entityClass'] = $entityClassName; - - if (isset($entityResult['fields'])) { - foreach ($entityResult['fields'] as $k => $field) { - if (! isset($field['name'])) { - throw MappingException::missingResultSetMappingFieldName($this->className, $resultMapping['name']); - } - - if (! isset($field['column'])) { - $fieldName = $field['name']; - - if (strpos($fieldName, '.')) { - list(, $fieldName) = explode('.', $fieldName); - } - - $resultMapping['entities'][$key]['fields'][$k]['column'] = $fieldName; - } - } - } - } - } - - $this->sqlResultSetMappings[$resultMapping['name']] = $resultMapping; - } - /** * Registers a custom repository class for the entity class. * @@ -1498,16 +1418,6 @@ public function setValueGenerationPlan(ValueGenerationPlan $valueGenerationPlan) $this->valueGenerationPlan = $valueGenerationPlan; } - /** - * Checks whether the class has a named native query with the given query name. - * - * @param string $name - */ - public function hasSqlResultSetMapping($name) : bool - { - return isset($this->sqlResultSetMappings[$name]); - } - /** * Marks this class as read only, no change tracking is applied to it. */ diff --git a/lib/Doctrine/ORM/Mapping/Driver/Annotation/AnnotationDriver.php b/lib/Doctrine/ORM/Mapping/Driver/Annotation/AnnotationDriver.php index 8bb05014b98..d6708abf534 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/Annotation/AnnotationDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/Annotation/AnnotationDriver.php @@ -973,45 +973,6 @@ private function convertCacheAnnotationToCacheMetadata( return new Mapping\CacheMetadata($usage, $region); } - /** - * @return mixed[] - */ - private function convertSqlResultSetMapping(Annotation\SqlResultSetMapping $resultSetMapping) - { - $entities = []; - - foreach ($resultSetMapping->entities as $entityResultAnnot) { - $entityResult = [ - 'fields' => [], - 'entityClass' => $entityResultAnnot->entityClass, - 'discriminatorColumn' => $entityResultAnnot->discriminatorColumn, - ]; - - foreach ($entityResultAnnot->fields as $fieldResultAnnot) { - $entityResult['fields'][] = [ - 'name' => $fieldResultAnnot->name, - 'column' => $fieldResultAnnot->column, - ]; - } - - $entities[] = $entityResult; - } - - $columns = []; - - foreach ($resultSetMapping->columns as $columnResultAnnot) { - $columns[] = [ - 'name' => $columnResultAnnot->name, - ]; - } - - return [ - 'name' => $resultSetMapping->name, - 'entities' => $entities, - 'columns' => $columns, - ]; - } - /** * @param Annotation\Annotation[] $classAnnotations */ diff --git a/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php b/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php index 5abe9b07b4d..1386f585a12 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php @@ -975,45 +975,6 @@ private function convertCacheAnnotationToCacheMetadata( return new Mapping\CacheMetadata($usage, $region); } - /** - * @return mixed[] - */ - private function convertSqlResultSetMapping(Annotation\SqlResultSetMapping $resultSetMapping) - { - $entities = []; - - foreach ($resultSetMapping->entities as $entityResultAnnot) { - $entityResult = [ - 'fields' => [], - 'entityClass' => $entityResultAnnot->entityClass, - 'discriminatorColumn' => $entityResultAnnot->discriminatorColumn, - ]; - - foreach ($entityResultAnnot->fields as $fieldResultAnnot) { - $entityResult['fields'][] = [ - 'name' => $fieldResultAnnot->name, - 'column' => $fieldResultAnnot->column, - ]; - } - - $entities[] = $entityResult; - } - - $columns = []; - - foreach ($resultSetMapping->columns as $columnResultAnnot) { - $columns[] = [ - 'name' => $columnResultAnnot->name, - ]; - } - - return [ - 'name' => $resultSetMapping->name, - 'entities' => $entities, - 'columns' => $columns, - ]; - } - /** * @param Annotation\Annotation[] $classAnnotations */ diff --git a/lib/Doctrine/ORM/Mapping/Driver/NewAnnotationDriver.php b/lib/Doctrine/ORM/Mapping/Driver/NewAnnotationDriver.php index 448f21586f4..235a870ce92 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/NewAnnotationDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/NewAnnotationDriver.php @@ -398,45 +398,6 @@ private function convertTableAnnotationToTableMetadata(Annotation\Table $tableAn return $table; } - /** - * @return mixed[] - */ - private function convertSqlResultSetMapping(Annotation\SqlResultSetMapping $resultSetMapping) - { - $entities = []; - - foreach ($resultSetMapping->entities as $entityResultAnnot) { - $entityResult = [ - 'fields' => [], - 'entityClass' => $entityResultAnnot->entityClass, - 'discriminatorColumn' => $entityResultAnnot->discriminatorColumn, - ]; - - foreach ($entityResultAnnot->fields as $fieldResultAnnot) { - $entityResult['fields'][] = [ - 'name' => $fieldResultAnnot->name, - 'column' => $fieldResultAnnot->column, - ]; - } - - $entities[] = $entityResult; - } - - $columns = []; - - foreach ($resultSetMapping->columns as $columnResultAnnot) { - $columns[] = [ - 'name' => $columnResultAnnot->name, - ]; - } - - return [ - 'name' => $resultSetMapping->name, - 'entities' => $entities, - 'columns' => $columns, - ]; - } - /** * Parse the given Cache as CacheMetadata *