diff options
| author | polo <ordipolo@gmx.fr> | 2026-10-18 00:08:23 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2026-10-18 00:10:03 +0200 |
| commit | 05e38eadbeb3de19e5b26003c2b401e00bb71df4 (patch) | |
| tree | cf48350b69cfce92de6f3a0e03eb0876931c7077 /vendor/doctrine/orm/src/Id/AssignedGenerator.php | |
| parent | 32843e50aa981f190bdb4fbc9adbeacc06fdf775 (diff) | |
| download | AppliGestionPHP-05e38eadbeb3de19e5b26003c2b401e00bb71df4.tar.gz AppliGestionPHP-05e38eadbeb3de19e5b26003c2b401e00bb71df4.tar.bz2 AppliGestionPHP-05e38eadbeb3de19e5b26003c2b401e00bb71df4.zip | |
sortie de vendor du dépôt, oubli dans config-template.ini
Diffstat (limited to 'vendor/doctrine/orm/src/Id/AssignedGenerator.php')
| -rw-r--r-- | vendor/doctrine/orm/src/Id/AssignedGenerator.php | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/vendor/doctrine/orm/src/Id/AssignedGenerator.php b/vendor/doctrine/orm/src/Id/AssignedGenerator.php deleted file mode 100644 index e11b341..0000000 --- a/vendor/doctrine/orm/src/Id/AssignedGenerator.php +++ /dev/null | |||
| @@ -1,45 +0,0 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\ORM\Id; | ||
| 6 | |||
| 7 | use Doctrine\ORM\EntityManagerInterface; | ||
| 8 | use Doctrine\ORM\Exception\EntityMissingAssignedId; | ||
| 9 | |||
| 10 | /** | ||
| 11 | * Special generator for application-assigned identifiers (doesn't really generate anything). | ||
| 12 | */ | ||
| 13 | class AssignedGenerator extends AbstractIdGenerator | ||
| 14 | { | ||
| 15 | /** | ||
| 16 | * Returns the identifier assigned to the given entity. | ||
| 17 | * | ||
| 18 | * {@inheritDoc} | ||
| 19 | * | ||
| 20 | * @throws EntityMissingAssignedId | ||
| 21 | */ | ||
| 22 | public function generateId(EntityManagerInterface $em, object|null $entity): array | ||
| 23 | { | ||
| 24 | $class = $em->getClassMetadata($entity::class); | ||
| 25 | $idFields = $class->getIdentifierFieldNames(); | ||
| 26 | $identifier = []; | ||
| 27 | |||
| 28 | foreach ($idFields as $idField) { | ||
| 29 | $value = $class->getFieldValue($entity, $idField); | ||
| 30 | |||
| 31 | if (! isset($value)) { | ||
| 32 | throw EntityMissingAssignedId::forField($entity, $idField); | ||
| 33 | } | ||
| 34 | |||
| 35 | if (isset($class->associationMappings[$idField])) { | ||
| 36 | // NOTE: Single Columns as associated identifiers only allowed - this constraint it is enforced. | ||
| 37 | $value = $em->getUnitOfWork()->getSingleIdentifierValue($value); | ||
| 38 | } | ||
| 39 | |||
| 40 | $identifier[$idField] = $value; | ||
| 41 | } | ||
| 42 | |||
| 43 | return $identifier; | ||
| 44 | } | ||
| 45 | } | ||
