*/ class ContainerAwareCommand extends Command implements ContainerAwareInterface { /** * @var ContainerInterface */ private $container; /** * @return ContainerInterface */ protected function getContainer() { if (null === $this->container) { $this->container = $this->getApplication()->getKernel()->getContainer(); } return $this->container; } /** * @see ContainerAwareInterface::setContainer() */ public function setContainer(ContainerInterface $container = null) { $this->container = $container; } }