Skip to content

Commit

Permalink
Add deprecation notices for container in DoctrineCommand
Browse files Browse the repository at this point in the history
This adds previously removed deprecation notices to DoctrineCommand. This helps people extending the command work around future BC breaks.
  • Loading branch information
alcaeus committed Apr 4, 2019
1 parent 4f0f2d1 commit 8be9091
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 8be9091

Please sign in to comment.