Skip to content

Commit

Permalink
Deprecate container injection in fixture classes with ContainerAwareI…
Browse files Browse the repository at this point in the history
…nterface (#801)
  • Loading branch information
GromNaN authored Dec 11, 2023
1 parent bf6366a commit c53d147
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
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 @@ public function addFixture(FixtureInterface $fixture): void
}

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);

$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.

0 comments on commit c53d147

Please sign in to comment.