Skip to content

[DoctrineBridge] Remove support for auto-mapping Doctrine entities to controller arguments #61176

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

Merged
merged 1 commit into from
Jul 21, 2025
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
[DoctrineBridge] Remove support for auto-mapping Doctrine entities to…
… controller arguments
  • Loading branch information
nicolas-grekas committed Jul 21, 2025
commit b706416f81374bece833f6185b8bed80c42d1cf5
2 changes: 1 addition & 1 deletion UPGRADE-8.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ DoctrineBridge
```php
$type = $extractor->getType(Foo::class, 'property');
```

* Remove support for auto-mapping Doctrine entities to controller arguments; use explicit mapping instead
* Make `ProxyCacheWarmer` class `final`

ExpressionLanguage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,10 @@
}

return $criteria;
} elseif (null === $mapping) {
trigger_deprecation('symfony/doctrine-bridge', '7.1', 'Relying on auto-mapping for Doctrine entities is deprecated for argument $%s of "%s": declare the mapping using either the #[MapEntity] attribute or mapped route parameters.', $argument->getName(), method_exists($argument, 'getControllerName') ? $argument->getControllerName() : 'n/a');
$mapping = $request->attributes->keys();
}

if ($mapping && array_is_list($mapping)) {
$mapping = array_combine($mapping, $mapping);

Check failure on line 195 in src/Symfony/Bridge/Doctrine/ArgumentResolver/EntityValueResolver.php

View workflow job for this annotation

GitHub Actions / Psalm

NoValue

src/Symfony/Bridge/Doctrine/ArgumentResolver/EntityValueResolver.php:195:48: NoValue: All possible types for this argument were invalidated - This may be dead code (see https://psalm.dev/179)

Check failure on line 195 in src/Symfony/Bridge/Doctrine/ArgumentResolver/EntityValueResolver.php

View workflow job for this annotation

GitHub Actions / Psalm

NoValue

src/Symfony/Bridge/Doctrine/ArgumentResolver/EntityValueResolver.php:195:38: NoValue: All possible types for this argument were invalidated - This may be dead code (see https://psalm.dev/179)

Check failure on line 195 in src/Symfony/Bridge/Doctrine/ArgumentResolver/EntityValueResolver.php

View workflow job for this annotation

GitHub Actions / Psalm

NoValue

src/Symfony/Bridge/Doctrine/ArgumentResolver/EntityValueResolver.php:195:48: NoValue: All possible types for this argument were invalidated - This may be dead code (see https://psalm.dev/179)

Check failure on line 195 in src/Symfony/Bridge/Doctrine/ArgumentResolver/EntityValueResolver.php

View workflow job for this annotation

GitHub Actions / Psalm

NoValue

src/Symfony/Bridge/Doctrine/ArgumentResolver/EntityValueResolver.php:195:38: NoValue: All possible types for this argument were invalidated - This may be dead code (see https://psalm.dev/179)
}

foreach ($options->exclude as $exclude) {
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Bridge/Doctrine/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
8.0
---

* Remove support for auto-mapping Doctrine entities to controller arguments; use explicit mapping instead
* Make `ProxyCacheWarmer` class `final`

7.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ public function testResolveWithoutManager()
$this->assertSame([], $resolver->resolve($request, $argument));
}

/**
* @group legacy
*/
public function testResolveWithNoIdAndDataOptional()
{
$manager = $this->createMock(ObjectManager::class);
Expand Down Expand Up @@ -247,9 +244,6 @@ public static function idsProvider(): iterable
yield ['foo'];
}

/**
* @group legacy
*/
public function testResolveGuessOptional()
{
$manager = $this->createMock(ObjectManager::class);
Expand All @@ -262,11 +256,7 @@ public function testResolveGuessOptional()
$argument = $this->createArgument('stdClass', new MapEntity(), 'arg', true);

$metadata = $this->createMock(ClassMetadata::class);
$manager->expects($this->once())
->method('getClassMetadata')
->with('stdClass')
->willReturn($metadata);

$manager->expects($this->never())->method('getClassMetadata');
$manager->expects($this->never())->method('getRepository');

$this->expectException(NearMissValueResolverException::class);
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy