"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php" between
symfony-4.4.14.tar.gz and symfony-4.4.15.tar.gz

About: Symfony is a web application framework for PHP projects. Source code (4.4 series).

Connection.php  (symfony-4.4.14):Connection.php  (symfony-4.4.15)
skipping to change at line 16 skipping to change at line 16
* (c) Fabien Potencier <fabien@symfony.com> * (c) Fabien Potencier <fabien@symfony.com>
* *
* For the full copyright and license information, please view the LICENSE * For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Symfony\Component\Messenger\Transport\Doctrine; namespace Symfony\Component\Messenger\Transport\Doctrine;
use Doctrine\DBAL\Connection as DBALConnection; use Doctrine\DBAL\Connection as DBALConnection;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\Result; use Doctrine\DBAL\Driver\Result as DriverResult;
use Doctrine\DBAL\Exception; use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Exception\TableNotFoundException; use Doctrine\DBAL\Exception\TableNotFoundException;
use Doctrine\DBAL\Query\QueryBuilder; use Doctrine\DBAL\Query\QueryBuilder;
use Doctrine\DBAL\Result;
use Doctrine\DBAL\Schema\Comparator; use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\Synchronizer\SchemaSynchronizer; use Doctrine\DBAL\Schema\Synchronizer\SchemaSynchronizer;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types; use Doctrine\DBAL\Types\Types;
use Symfony\Component\Messenger\Exception\InvalidArgumentException; use Symfony\Component\Messenger\Exception\InvalidArgumentException;
use Symfony\Component\Messenger\Exception\TransportException; use Symfony\Component\Messenger\Exception\TransportException;
/** /**
* @author Vincent Touzet <vincent.touzet@gmail.com> * @author Vincent Touzet <vincent.touzet@gmail.com>
skipping to change at line 169 skipping to change at line 170
$query = $this->createAvailableMessagesQueryBuilder() $query = $this->createAvailableMessagesQueryBuilder()
->orderBy('available_at', 'ASC') ->orderBy('available_at', 'ASC')
->setMaxResults(1); ->setMaxResults(1);
// use SELECT ... FOR UPDATE to lock table // use SELECT ... FOR UPDATE to lock table
$stmt = $this->executeQuery( $stmt = $this->executeQuery(
$query->getSQL().' '.$this->driverConnection->getDatabasePlatfor m()->getWriteLockSQL(), $query->getSQL().' '.$this->driverConnection->getDatabasePlatfor m()->getWriteLockSQL(),
$query->getParameters(), $query->getParameters(),
$query->getParameterTypes() $query->getParameterTypes()
); );
$doctrineEnvelope = $stmt instanceof Result ? $stmt->fetchAssociativ e() : $stmt->fetch(); $doctrineEnvelope = $stmt instanceof Result || $stmt instanceof Driv erResult ? $stmt->fetchAssociative() : $stmt->fetch();
if (false === $doctrineEnvelope) { if (false === $doctrineEnvelope) {
$this->driverConnection->commit(); $this->driverConnection->commit();
return null; return null;
} }
$doctrineEnvelope = $this->decodeEnvelopeHeaders($doctrineEnvelope); $doctrineEnvelope = $this->decodeEnvelopeHeaders($doctrineEnvelope);
$queryBuilder = $this->driverConnection->createQueryBuilder() $queryBuilder = $this->driverConnection->createQueryBuilder()
skipping to change at line 257 skipping to change at line 258
} }
public function getMessageCount(): int public function getMessageCount(): int
{ {
$queryBuilder = $this->createAvailableMessagesQueryBuilder() $queryBuilder = $this->createAvailableMessagesQueryBuilder()
->select('COUNT(m.id) as message_count') ->select('COUNT(m.id) as message_count')
->setMaxResults(1); ->setMaxResults(1);
$stmt = $this->executeQuery($queryBuilder->getSQL(), $queryBuilder->getP arameters(), $queryBuilder->getParameterTypes()); $stmt = $this->executeQuery($queryBuilder->getSQL(), $queryBuilder->getP arameters(), $queryBuilder->getParameterTypes());
return $stmt instanceof Result ? $stmt->fetchOne() : $stmt->fetchColumn( ); return $stmt instanceof Result || $stmt instanceof DriverResult ? $stmt- >fetchOne() : $stmt->fetchColumn();
} }
public function findAll(int $limit = null): array public function findAll(int $limit = null): array
{ {
$queryBuilder = $this->createAvailableMessagesQueryBuilder(); $queryBuilder = $this->createAvailableMessagesQueryBuilder();
if (null !== $limit) { if (null !== $limit) {
$queryBuilder->setMaxResults($limit); $queryBuilder->setMaxResults($limit);
} }
$stmt = $this->executeQuery($queryBuilder->getSQL(), $queryBuilder->getP arameters(), $queryBuilder->getParameterTypes()); $stmt = $this->executeQuery($queryBuilder->getSQL(), $queryBuilder->getP arameters(), $queryBuilder->getParameterTypes());
$data = $stmt instanceof Result ? $stmt->fetchAllAssociative() : $stmt-> fetchAll(); $data = $stmt instanceof Result || $stmt instanceof DriverResult ? $stmt ->fetchAllAssociative() : $stmt->fetchAll();
return array_map(function ($doctrineEnvelope) { return array_map(function ($doctrineEnvelope) {
return $this->decodeEnvelopeHeaders($doctrineEnvelope); return $this->decodeEnvelopeHeaders($doctrineEnvelope);
}, $data); }, $data);
} }
public function find($id): ?array public function find($id): ?array
{ {
$queryBuilder = $this->createQueryBuilder() $queryBuilder = $this->createQueryBuilder()
->where('m.id = ?'); ->where('m.id = ?');
$stmt = $this->executeQuery($queryBuilder->getSQL(), [$id]); $stmt = $this->executeQuery($queryBuilder->getSQL(), [$id]);
$data = $stmt instanceof Result ? $stmt->fetchAssociative() : $stmt->fet ch(); $data = $stmt instanceof Result || $stmt instanceof DriverResult ? $stmt ->fetchAssociative() : $stmt->fetch();
return false === $data ? null : $this->decodeEnvelopeHeaders($data); return false === $data ? null : $this->decodeEnvelopeHeaders($data);
} }
private function createAvailableMessagesQueryBuilder(): QueryBuilder private function createAvailableMessagesQueryBuilder(): QueryBuilder
{ {
$now = new \DateTime(); $now = new \DateTime();
$redeliverLimit = (clone $now)->modify(sprintf('-%d seconds', $this->con figuration['redeliver_timeout'])); $redeliverLimit = (clone $now)->modify(sprintf('-%d seconds', $this->con figuration['redeliver_timeout']));
return $this->createQueryBuilder() return $this->createQueryBuilder()
 End of changes. 6 change blocks. 
5 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)