Problem with container custom function


i created a custom function for my container;

$this->app->getContainer()[‘cms.store_location.repository’] = function ($container) {
return new StoreLocationRepository($container[“cms.client”]);

The problem is that when i acces $this->app->getContainer()[‘cms.store_location.repository’] for the first time, a StoreLocationRepository instance is created, but all the other time i access $this->app->getContainer()[‘cms.store_location.repository’], no new instance is created.

Is there any cache on the container??

I dont understand why a new instance of StoreLocationRepository is not created every time i access this variable…


Have you tried this :
$container = $this->app->getContainer();
$container['cms.store_location.repository’] = function ($c) {
return new StoreLocationRepository($c[“cms.client”]);

Hi, it doesnt change anything. this is the same as the code i have