From f06e49c1979a8e4e454e63344b8aadd18186e3dc Mon Sep 17 00:00:00 2001 From: Cliff Odijk Date: Wed, 11 Jun 2014 11:58:07 +0200 Subject: [PATCH] Move __construct after the repository assignment The configure function is called from the parent::__construct(); so the $this->nameRepository is still empty during the configure. Thats why it should be the other way around. --- cookbook/console/commands_as_services.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbook/console/commands_as_services.rst b/cookbook/console/commands_as_services.rst index 60f22824686..a60ebaa11e7 100644 --- a/cookbook/console/commands_as_services.rst +++ b/cookbook/console/commands_as_services.rst @@ -90,9 +90,9 @@ have some ``NameRepository`` service that you'll use to get your default value:: public function __construct(NameRepository $nameRepository) { - parent::__construct(); - $this->nameRepository = $nameRepository; + + parent::__construct(); } protected function configure()