Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Text
Posted by: userc865b
Added: Jan 31, 2018 3:42 PM
Modified: Jan 31, 2018 10:17 PM
Views: 13
Tags: symfony
set your own container and parameter
  1. $container= new ContainerBuilder(); // but this will be a new container the services.yml are not valid then!
  2.             $container->setParameter('city',$city);
  3.             $container->register(WeatherData::class)->addArgument("%city%");
  4.             $this->setContainer($container);
  5.             echo $parm=$this->container->getParameter('city');die;