Skip to content

Commit

Permalink
Remove dead code leftovers after doctrine#7095
Browse files Browse the repository at this point in the history
  • Loading branch information
Majkl578 committed Mar 4, 2018
1 parent cf548e9 commit 2080f50
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 208 deletions.
6 changes: 5 additions & 1 deletion UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
90 changes: 0 additions & 90 deletions lib/Doctrine/ORM/Mapping/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
*/
Expand Down
39 changes: 0 additions & 39 deletions lib/Doctrine/ORM/Mapping/Driver/Annotation/AnnotationDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
39 changes: 0 additions & 39 deletions lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -977,45 +977,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
*/
Expand Down
39 changes: 0 additions & 39 deletions lib/Doctrine/ORM/Mapping/Driver/NewAnnotationDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,45 +400,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
*
Expand Down

0 comments on commit 2080f50

Please sign in to comment.