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

Add support to doctrine ORM 3 and drop support for Doctrin ORM 2 #139

Merged
merged 3 commits into from
Feb 17, 2024
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
## [Unreleased]
### Added
* Add new `RequestIdMiddleware`.
* Add support for Doctrine ORM 3.0.0

### Changed
* Update dependencies
Expand All @@ -20,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
* Remove support for non-URL-encoded credentials in redis URIs.
* Remove `json_decode` and `json_encode` functions.
* Remove support for openswoole.
* Drop support for Doctrine ORM 2.x

### Fixed
* *Nothing*
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"ext-fileinfo": "*",
"akrabat/ip-address-middleware": "^2.1",
"cakephp/chronos": "^3.0.2",
"doctrine/orm": "^2.17",
"doctrine/orm": "^3.0",
"endroid/qr-code": "^4.8",
"fig/http-message-util": "^1.1",
"guzzlehttp/guzzle": "^7.8",
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/NoDbNameConnectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ public function __invoke(ContainerInterface $container): Connection
$params = $conn->getParams();
unset($params['dbname']);

return new Connection($params, $conn->getDriver(), $conn->getConfiguration(), $em->getEventManager());
return new Connection($params, $conn->getDriver(), $conn->getConfiguration());
}
}
7 changes: 2 additions & 5 deletions src/Doctrine/Type/ChronosDateTimeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\DBAL\Types\DateTimeImmutableType;
use Doctrine\DBAL\Types\Exception\InvalidType;

class ChronosDateTimeType extends DateTimeImmutableType
{
Expand Down Expand Up @@ -48,10 +49,6 @@ public function convertToDatabaseValue(mixed $value, AbstractPlatform $platform)
return $value->format($platform->getDateTimeFormatString());
}

throw ConversionException::conversionFailedInvalidType(
$value,
$this->getName(),
['null', DateTimeInterface::class],
);
throw InvalidType::new($value, $this->getName(), ['null', DateTimeInterface::class]);
}
}
2 changes: 1 addition & 1 deletion test/Doctrine/EntityRepositoryFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function setUp(): void
public function createsRequestedRepositoryClass(string $repoClass): void
{
$this->em->expects($this->once())->method('getClassMetadata')->with(stdClass::class)->willReturn(
$this->createMock(ClassMetadata::class),
new ClassMetadata(stdClass::class),
);

$repoInstance = EntityRepositoryFactory::{stdClass::class}($this->container, $repoClass);
Expand Down
1 change: 0 additions & 1 deletion test/Doctrine/NoDbNameConnectionFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public function newConnectionIsCreatedRemovingDbNameFromOriginalConnectionParams
$this->originalConn->expects($this->once())->method('getParams')->willReturn($params);
$this->originalConn->expects($this->once())->method('getDriver')->willReturn($this->createMock(Driver::class));
$this->originalConn->expects($this->once())->method('getConfiguration')->willReturn(new Configuration());
$this->em->expects($this->once())->method('getEventManager')->willReturn(null);
$this->em->expects($this->once())->method('getConnection')->willReturn($this->originalConn);
$this->container->expects($this->once())->method('get')->with(EntityManager::class)->willReturn($this->em);

Expand Down
Loading