Skip to content

Commit 13e6efd

Browse files
[DependencyInjection] Deprecate ContainerAwareInterface, ContainerAwareTrait and ContainerAwareLoader
1 parent 6968949 commit 13e6efd

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CHANGELOG
77
* Deprecate `DbalLogger`, use a middleware instead
88
* Deprecate not constructing `DoctrineDataCollector` with an instance of `DebugDataHolder`
99
* Deprecate `DoctrineDataCollector::addLogger()`, use a `DebugDataHolder` instead
10+
* Deprecate `ContainerAwareLoader`, use dependency injection in your fixtures instead
1011

1112
6.3
1213
---

DataFixtures/ContainerAwareLoader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@
1616
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
1717
use Symfony\Component\DependencyInjection\ContainerInterface;
1818

19+
trigger_deprecation('symfony/dependency-injection', '6.4', '"%s" is deprecated, use dependency injection in your fixtures instead.', ContainerAwareLoader::class);
20+
1921
/**
2022
* Doctrine data fixtures loader that injects the service container into
2123
* fixture objects that implement ContainerAwareInterface.
2224
*
2325
* Note: Use of this class requires the Doctrine data fixtures extension, which
2426
* is a suggested dependency for Symfony.
27+
*
28+
* @deprecated since Symfony 6.4, use dependency injection in your fixtures instead
2529
*/
2630
class ContainerAwareLoader extends Loader
2731
{

Tests/DataFixtures/ContainerAwareLoaderTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
use Symfony\Bridge\Doctrine\Tests\Fixtures\ContainerAwareFixture;
1717
use Symfony\Component\DependencyInjection\ContainerInterface;
1818

19+
/**
20+
* @group legacy
21+
*/
1922
class ContainerAwareLoaderTest extends TestCase
2023
{
2124
public function testShouldSetContainerOnContainerAwareFixture()

Tests/Fixtures/ContainerAwareFixture.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
1717
use Symfony\Component\DependencyInjection\ContainerInterface;
1818

19+
/**
20+
* @deprecated since Symfony 6.4, to be removed in 7.0
21+
*/
1922
class ContainerAwareFixture implements FixtureInterface, ContainerAwareInterface
2023
{
2124
public ?ContainerInterface $container = null;

0 commit comments

Comments
 (0)