Skip to content

Commit 1e3dda1

Browse files
Merge branch '5.4' into 6.4
* 5.4: Issue #58821: [DependencyInjection] Support interfaces in ContainerBuilder::getReflectionClass(). Dynamically fix compatibility with doctrine/data-fixtures v2 [HttpKernel] Ensure HttpCache::getTraceKey() does not throw exception don't call EntityManager::initializeObject() with scalar values [Validator] review italian translations Update PR template
2 parents 402d583 + 43ed5e3 commit 1e3dda1

File tree

4 files changed

+40
-6
lines changed

4 files changed

+40
-6
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\Doctrine\DataFixtures;
13+
14+
use Doctrine\Common\DataFixtures\FixtureInterface;
15+
use Doctrine\Common\DataFixtures\ReferenceRepository;
16+
17+
if (method_exists(ReferenceRepository::class, 'getReferences')) {
18+
/** @internal */
19+
trait AddFixtureImplementation
20+
{
21+
public function addFixture(FixtureInterface $fixture)
22+
{
23+
$this->doAddFixture($fixture);
24+
}
25+
}
26+
} else {
27+
/** @internal */
28+
trait AddFixtureImplementation
29+
{
30+
public function addFixture(FixtureInterface $fixture): void
31+
{
32+
$this->doAddFixture($fixture);
33+
}
34+
}
35+
}

DataFixtures/ContainerAwareLoader.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,14 @@
2929
*/
3030
class ContainerAwareLoader extends Loader
3131
{
32+
use AddFixtureImplementation;
33+
3234
public function __construct(
3335
private readonly ContainerInterface $container,
3436
) {
3537
}
3638

37-
/**
38-
* @return void
39-
*/
40-
public function addFixture(FixtureInterface $fixture)
39+
private function doAddFixture(FixtureInterface $fixture): void
4140
{
4241
if ($fixture instanceof ContainerAwareInterface) {
4342
$fixture->setContainer($this->container);

Validator/Constraints/UniqueEntityValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function validate(mixed $entity, Constraint $constraint)
102102

103103
$criteria[$fieldName] = $fieldValue;
104104

105-
if (null !== $criteria[$fieldName] && $class->hasAssociation($fieldName)) {
105+
if (\is_object($criteria[$fieldName]) && $class->hasAssociation($fieldName)) {
106106
/* Ensure the Proxy is initialized before using reflection to
107107
* read its identifiers. This is necessary because the wrapped
108108
* getter methods in the Proxy are being bypassed.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"symfony/validator": "^6.4|^7.0",
4545
"symfony/var-dumper": "^5.4|^6.0|^7.0",
4646
"doctrine/collections": "^1.0|^2.0",
47-
"doctrine/data-fixtures": "^1.1",
47+
"doctrine/data-fixtures": "^1.1|^2",
4848
"doctrine/dbal": "^2.13.1|^3|^4",
4949
"doctrine/orm": "^2.15|^3",
5050
"psr/log": "^1|^2|^3"

0 commit comments

Comments
 (0)