mailpoet
/
vendor-prefixed
/
doctrine
/
orm
/
src
/
Exception
/
EntityIdentityCollisionException.php
ConfigurationException.php
9 months ago
EntityIdentityCollisionException.php
9 months ago
EntityManagerClosed.php
9 months ago
EntityMissingAssignedId.php
9 months ago
InvalidEntityRepository.php
9 months ago
InvalidHydrationMode.php
9 months ago
ManagerException.php
9 months ago
MismatchedEventManager.php
9 months ago
MissingIdentifierField.php
9 months ago
MissingMappingDriverImplementation.php
9 months ago
MultipleSelectorsFoundException.php
9 months ago
NamedNativeQueryNotFound.php
9 months ago
NamedQueryNotFound.php
9 months ago
NotSupported.php
9 months ago
ORMException.php
9 months ago
PersisterException.php
9 months ago
ProxyClassesAlwaysRegenerating.php
9 months ago
RepositoryException.php
9 months ago
SchemaToolException.php
9 months ago
UnexpectedAssociationValue.php
9 months ago
UnknownEntityNamespace.php
9 months ago
UnrecognizedIdentifierFields.php
9 months ago
index.php
9 months ago
EntityIdentityCollisionException.php
27 lines
| 1 | <?php |
| 2 | declare (strict_types=1); |
| 3 | namespace MailPoetVendor\Doctrine\ORM\Exception; |
| 4 | if (!defined('ABSPATH')) exit; |
| 5 | use function get_class; |
| 6 | use function sprintf; |
| 7 | final class EntityIdentityCollisionException extends ORMException |
| 8 | { |
| 9 | public static function create($existingEntity, $newEntity, string $idHash) : self |
| 10 | { |
| 11 | return new self(sprintf(<<<'EXCEPTION' |
| 12 | While adding an entity of class %s with an ID hash of "%s" to the identity map, |
| 13 | another object of class %s was already present for the same ID. This exception |
| 14 | is a safeguard against an internal inconsistency - IDs should uniquely map to |
| 15 | entity object instances. This problem may occur if: |
| 16 | - you use application-provided IDs and reuse ID values; |
| 17 | - database-provided IDs are reassigned after truncating the database without |
| 18 | clearing the EntityManager; |
| 19 | - you might have been using EntityManager#getReference() to create a reference |
| 20 | for a nonexistent ID that was subsequently (by the RDBMS) assigned to another |
| 21 | entity. |
| 22 | Otherwise, it might be an ORM-internal inconsistency, please report it. |
| 23 | EXCEPTION |
| 24 | , get_class($newEntity), $idHash, get_class($existingEntity))); |
| 25 | } |
| 26 | } |
| 27 |