Skip to content

Commit

Permalink
Merge pull request #946 from alcaeus/deprecate-container-functionality
Browse files Browse the repository at this point in the history
Add deprecation notices for container in DoctrineCommand
  • Loading branch information
alcaeus committed Apr 4, 2019
2 parents 90a7508 + 8be9091 commit d295756
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Command/DoctrineCommand.php
Expand Up @@ -28,6 +28,14 @@ public function __construct(ManagerRegistry $doctrine = null)
{
parent::__construct();

if ($doctrine === null) {
@trigger_error(sprintf(
'The "%s" constructor expects a "%s" instance as first argument, not passing it will throw a \TypeError in DoctrineBundle 2.0.',
static::class,
ManagerRegistry::class
), E_USER_DEPRECATED);
}

$this->doctrine = $doctrine;
}

Expand All @@ -36,6 +44,8 @@ public function __construct(ManagerRegistry $doctrine = null)
*/
public function setContainer(ContainerInterface $container = null)
{
@trigger_error(sprintf('The "%s()" method is deprecated and will be removed in DoctrineBundle 2.0.', __METHOD__), E_USER_DEPRECATED);

$this->container = $container;
}

Expand All @@ -48,6 +58,8 @@ public function setContainer(ContainerInterface $container = null)
*/
protected function getContainer()
{
@trigger_error(sprintf('The "%s()" method is deprecated and will be removed in DoctrineBundle 2.0.', __METHOD__), E_USER_DEPRECATED);

if ($this->container === null) {
$application = $this->getApplication();
if ($application === null) {
Expand Down

0 comments on commit d295756

Please sign in to comment.