![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/vendor/doctrine/orm/src/Id/ |
<?php declare(strict_types=1); namespace Doctrine\ORM\Id; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Exception\EntityMissingAssignedId; use function get_class; /** * Special generator for application-assigned identifiers (doesn't really generate anything). */ class AssignedGenerator extends AbstractIdGenerator { /** * Returns the identifier assigned to the given entity. * * {@inheritDoc} * * @throws EntityMissingAssignedId */ public function generateId(EntityManagerInterface $em, $entity) { $class = $em->getClassMetadata(get_class($entity)); $idFields = $class->getIdentifierFieldNames(); $identifier = []; foreach ($idFields as $idField) { $value = $class->getFieldValue($entity, $idField); if (! isset($value)) { throw EntityMissingAssignedId::forField($entity, $idField); } if (isset($class->associationMappings[$idField])) { // NOTE: Single Columns as associated identifiers only allowed - this constraint it is enforced. $value = $em->getUnitOfWork()->getSingleIdentifierValue($value); } $identifier[$idField] = $value; } return $identifier; } }