Skip to content

Commit

Permalink
Move __construct after the repository assignment
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cmodijk committed Jun 11, 2014
1 parent 140e54e commit f06e49c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cookbook/console/commands_as_services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit f06e49c

Please sign in to comment.