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

Deprecate container injection in fixture classes with ContainerAwareInterface #801

Merged
merged 1 commit into from
Dec 11, 2023
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
3 changes: 3 additions & 0 deletions Loader/SymfonyFixturesLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use function array_values;
use function get_class;
use function sprintf;
use function trigger_deprecation;

final class SymfonyFixturesLoader extends Loader implements SymfonyFixturesLoaderInterface
{
Expand Down Expand Up @@ -68,6 +69,8 @@
}

if ($fixture instanceof ContainerAwareInterface) {
trigger_deprecation('doctrine/mongodb-odm-bundle', '4.7', 'Implementing "%s" with "%s" is deprecated, use dependency injection instead.', ContainerAwareInterface::class, FixtureInterface::class);

Check warning on line 72 in Loader/SymfonyFixturesLoader.php

View check run for this annotation

Codecov / codecov/patch

Loader/SymfonyFixturesLoader.php#L72

Added line #L72 was not covered by tests

$fixture->setContainer($this->container);
}

Expand Down
2 changes: 2 additions & 0 deletions UPGRADE-4.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ UPGRADE FROM 4.6 to 4.7
* The `fixture_loader` configuration option was deprecated and will be removed
in 5.0.
* The `doctrine_mongodb.odm.fixture_loader` parameter has been removed.
* Implementing `ContainerAwareInterface` on fixtures classes is deprecated,
use dependency injection instead.