Skip to content

Commit

Permalink
Made possible to inject any (e.g. mocked) container into Controller
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleBigDev committed Apr 17, 2018
1 parent 27c3822 commit 9a29980
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion classes/controller/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ public function init()
define('_PS_BASE_URL_SSL_', Tools::getShopDomainSsl(true));
}

$this->container = $this->buildContainer();
if (null === $this->container) {
$this->container = $this->buildContainer();
}
$localeRepo = $this->get(self::SERVICE_LOCALE_REPOSITORY);
$this->context->currentLocale = $localeRepo->getLocale($this->context->language->locale);
}
Expand Down Expand Up @@ -735,4 +737,16 @@ public function getContainer()
{
return $this->container;
}

/**
* @param ContainerBuilder $container
*
* @return $this
*/
public function setContainer($container)
{
$this->container = $container;

return $this;
}
}

0 comments on commit 9a29980

Please sign in to comment.