Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove references to Type::DATETIME #8944

Merged
merged 1 commit into from
Aug 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Doctrine\Performance\Query;

use DateTime;
use Doctrine\DBAL\Types\DateTimeType;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Query;
use Doctrine\Performance\EntityManagerFactory;
use PhpBench\Benchmark\Metadata\Annotations\BeforeMethods;
Expand Down Expand Up @@ -59,7 +59,7 @@ public function init(): void

foreach (range(1, 10) as $index) {
$this->parsedQueryWithInferredParameterType->setParameter('parameter' . $index, new DateTime());
$this->parsedQueryWithDeclaredParameterType->setParameter('parameter' . $index, new DateTime(), DateTimeType::DATETIME);
$this->parsedQueryWithDeclaredParameterType->setParameter('parameter' . $index, new DateTime(), Types::DATETIME_MUTABLE);
}

// Force parsing upfront - we don't benchmark that bit in this scenario
Expand Down
6 changes: 3 additions & 3 deletions tests/Doctrine/Tests/ORM/Functional/TypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use DateTime;
use DateTimeZone;
use Doctrine\DBAL\Types\Type as DBALType;
use Doctrine\DBAL\Types\Types;
use Doctrine\Tests\Models\Generic\BooleanModel;
use Doctrine\Tests\Models\Generic\DateTimeModel;
use Doctrine\Tests\Models\Generic\DecimalModel;
Expand Down Expand Up @@ -146,7 +146,7 @@ public function testDqlQueryBindDateTimeInstance(): void
$this->_em->clear();

$dateTimeDb = $this->_em->createQuery('SELECT d FROM Doctrine\Tests\Models\Generic\DateTimeModel d WHERE d.datetime = ?1')
->setParameter(1, $date, DBALType::DATETIME)
->setParameter(1, $date, Types::DATETIME_MUTABLE)
->getSingleResult();

self::assertInstanceOf(DateTime::class, $dateTimeDb->datetime);
Expand All @@ -168,7 +168,7 @@ public function testDqlQueryBuilderBindDateTimeInstance(): void
->select('d')
->from(DateTimeModel::class, 'd')
->where('d.datetime = ?1')
->setParameter(1, $date, DBALType::DATETIME)
->setParameter(1, $date, Types::DATETIME_MUTABLE)
->getQuery()->getSingleResult();

self::assertInstanceOf(DateTime::class, $dateTimeDb->datetime);
Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/ORM/Query/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Doctrine\Common\Cache\Psr6\DoctrineProvider;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Internal\Hydration\IterableResult;
use Doctrine\ORM\Query\Parameter;
use Doctrine\ORM\Query\QueryException;
Expand Down Expand Up @@ -505,7 +505,7 @@ public function testValuesAreNotBeingResolvedForSpecifiedParameterTypes(): void

$query = $this->entityManager->createQuery('SELECT d FROM ' . DateTimeModel::class . ' d WHERE d.datetime = :value');

$query->setParameter('value', new DateTime(), Type::DATETIME);
$query->setParameter('value', new DateTime(), Types::DATETIME_MUTABLE);

self::assertEmpty($query->getResult());
}
Expand Down