From 8be90914364d469da25917a12911c46c522a6ff0 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Thu, 4 Apr 2019 14:36:31 +0200 Subject: [PATCH] Add deprecation notices for container in DoctrineCommand This adds previously removed deprecation notices to DoctrineCommand. This helps people extending the command work around future BC breaks. --- Command/DoctrineCommand.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Command/DoctrineCommand.php b/Command/DoctrineCommand.php index e881d02a2..eccce7db1 100644 --- a/Command/DoctrineCommand.php +++ b/Command/DoctrineCommand.php @@ -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; } @@ -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; } @@ -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) {