![]() 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\DBAL\Connections\PrimaryReadReplicaConnection; use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\Deprecations\Deprecation; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Exception\NotSupported; use function method_exists; use function sprintf; /** * Represents an ID generator that uses the database UUID expression * * @deprecated use an application-side generator instead */ class UuidGenerator extends AbstractIdGenerator { public function __construct() { Deprecation::trigger( 'doctrine/orm', 'https://github.com/doctrine/orm/issues/7312', '%s is deprecated with no replacement, use an application-side generator instead', self::class ); if (! method_exists(AbstractPlatform::class, 'getGuidExpression')) { throw NotSupported::createForDbal3(sprintf( 'Using the database to generate a UUID through %s', self::class )); } } /** * {@inheritDoc} * * @throws NotSupported */ public function generateId(EntityManagerInterface $em, $entity) { $connection = $em->getConnection(); $sql = 'SELECT ' . $connection->getDatabasePlatform()->getGuidExpression(); if ($connection instanceof PrimaryReadReplicaConnection) { $connection->ensureConnectedToPrimary(); } return $connection->executeQuery($sql)->fetchOne(); } }