AbstractIdGenerator.php
9 months ago
AssignedGenerator.php
9 months ago
BigIntegerIdentityGenerator.php
9 months ago
IdentityGenerator.php
9 months ago
SequenceGenerator.php
9 months ago
TableGenerator.php
9 months ago
UuidGenerator.php
9 months ago
index.php
9 months ago
AbstractIdGenerator.php
42 lines
| 1 | <?php |
| 2 | declare (strict_types=1); |
| 3 | namespace MailPoetVendor\Doctrine\ORM\Id; |
| 4 | if (!defined('ABSPATH')) exit; |
| 5 | use MailPoetVendor\Doctrine\Deprecations\Deprecation; |
| 6 | use MailPoetVendor\Doctrine\ORM\EntityManager; |
| 7 | use MailPoetVendor\Doctrine\ORM\EntityManagerInterface; |
| 8 | use InvalidArgumentException; |
| 9 | use LogicException; |
| 10 | use function get_debug_type; |
| 11 | use function sprintf; |
| 12 | abstract class AbstractIdGenerator |
| 13 | { |
| 14 | private $alreadyDelegatedToGenerateId = \false; |
| 15 | public function generate(EntityManager $em, $entity) |
| 16 | { |
| 17 | if ($this->alreadyDelegatedToGenerateId) { |
| 18 | throw new LogicException(sprintf('Endless recursion detected in %s. Please implement generateId() without calling the parent implementation.', get_debug_type($this))); |
| 19 | } |
| 20 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9325', '%s::generate() is deprecated, call generateId() instead.', get_debug_type($this)); |
| 21 | $this->alreadyDelegatedToGenerateId = \true; |
| 22 | try { |
| 23 | return $this->generateId($em, $entity); |
| 24 | } finally { |
| 25 | $this->alreadyDelegatedToGenerateId = \false; |
| 26 | } |
| 27 | } |
| 28 | public function generateId(EntityManagerInterface $em, $entity) |
| 29 | { |
| 30 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9325', 'Not implementing %s in %s is deprecated.', __FUNCTION__, get_debug_type($this)); |
| 31 | if (!$em instanceof EntityManager) { |
| 32 | throw new InvalidArgumentException('Unsupported entity manager implementation.'); |
| 33 | } |
| 34 | // @phpstan-ignore method.deprecated |
| 35 | return $this->generate($em, $entity); |
| 36 | } |
| 37 | public function isPostInsertGenerator() |
| 38 | { |
| 39 | return \false; |
| 40 | } |
| 41 | } |
| 42 |