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
IdentityGenerator.php
26 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\EntityManagerInterface; |
| 7 | class IdentityGenerator extends AbstractIdGenerator |
| 8 | { |
| 9 | private $sequenceName; |
| 10 | public function __construct($sequenceName = null) |
| 11 | { |
| 12 | if ($sequenceName !== null) { |
| 13 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/issues/8850', 'Passing a sequence name to the IdentityGenerator is deprecated in favor of using %s. $sequenceName will be removed in ORM 3.0', SequenceGenerator::class); |
| 14 | } |
| 15 | $this->sequenceName = $sequenceName; |
| 16 | } |
| 17 | public function generateId(EntityManagerInterface $em, $entity) |
| 18 | { |
| 19 | return (int) $em->getConnection()->lastInsertId($this->sequenceName); |
| 20 | } |
| 21 | public function isPostInsertGenerator() |
| 22 | { |
| 23 | return \true; |
| 24 | } |
| 25 | } |
| 26 |