Skip to content

Commit

Permalink
Merge pull request doctrine#8851 from greg0ire/backport-7008
Browse files Browse the repository at this point in the history
Remove unused exceptions
  • Loading branch information
greg0ire authored Jul 21, 2021
2 parents 52f5528 + 6b481be commit 3e18990
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 64 deletions.
9 changes: 9 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Upgrade to 2.10

## Minor BC BREAK: some exception methods have been removed

The following methods were not in use and are very unlikely to be used by
downstream packages or applications, and were consequently removed:

- `ORMException::entityMissingForeignAssignedId`
- `ORMException::entityMissingAssignedIdForField`
- `ORMException::invalidFlushMode`

## Deprecated: database-side UUID generation

[DB-generated UUIDs are deprecated as of `doctrine/dbal` 2.8][DBAL deprecation].
Expand Down
64 changes: 0 additions & 64 deletions lib/Doctrine/ORM/ORMException.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,41 +54,6 @@ public static function namedNativeQueryNotFound($nativeQueryName)
return new self('Could not find a named native query by the name "' . $nativeQueryName . '"');
}

/**
* @deprecated No replacement planned
*
* @param object $entity
* @param object $relatedEntity
*
* @return ORMException
*/
public static function entityMissingForeignAssignedId($entity, $relatedEntity)
{
return new self(
'Entity of type ' . get_class($entity) . ' has identity through a foreign entity ' . get_class($relatedEntity) . ', ' .
'however this entity has no identity itself. You have to call EntityManager#persist() on the related entity ' .
"and make sure that an identifier was generated before trying to persist '" . get_class($entity) . "'. In case " .
'of Post Insert ID Generation (such as MySQL Auto-Increment) this means you have to call ' .
'EntityManager#flush() between both persist operations.'
);
}

/**
* @deprecated Use Doctrine\ORM\Exception\EntityMissingAssignedId
*
* @param object $entity
* @param string $field
*
* @return ORMException
*/
public static function entityMissingAssignedIdForField($entity, $field)
{
return new self('Entity of type ' . get_class($entity) . " is missing an assigned ID for field '" . $field . "'. " .
'The identifier generation strategy for this entity requires the ID field to be populated before ' .
'EntityManager#persist() is called. If you want automatically generated identifiers instead ' .
'you need to adjust the metadata mapping accordingly.');
}

/**
* @deprecated Use Doctrine\ORM\Persisters\Exception\UnrecognizedField
*
Expand Down Expand Up @@ -129,18 +94,6 @@ public static function invalidOrientation($className, $field)
return new self('Invalid order by orientation specified for ' . $className . '#' . $field);
}

/**
* @deprecated No replacement planned
*
* @param string $mode
*
* @return ORMException
*/
public static function invalidFlushMode($mode)
{
return new self(sprintf("'%s' is an invalid flush mode.", $mode));
}

/**
* @deprecated Use Doctrine\ORM\Exception\EntityManagerClosed
*
Expand Down Expand Up @@ -194,23 +147,6 @@ public static function findByRequiresParameter($methodName)
*
* @return ORMException
*/
public static function invalidFindByCall($entityName, $fieldName, $method)
{
return new self(
"Entity '" . $entityName . "' has no field '" . $fieldName . "'. " .
"You can therefore not call '" . $method . "' on the entities' repository"
);
}

/**
* @deprecated Doctrine\ORM\Repository\Exception\InvalidMagicMethodCall
*
* @param string $entityName
* @param string $fieldName
* @param string $method
*
* @return ORMException
*/
public static function invalidMagicCall($entityName, $fieldName, $method)
{
return new self(
Expand Down

0 comments on commit 3e18990

Please sign in to comment.