示例#1
0
 public function testRecursiveParameters()
 {
     $this->container->setParameter('actor.profile.firstname', 'Jack');
     $this->container->setParameter('actor.profile.lastname', 'Chen');
     $this->container->setParameter('actor.profile.username', '%actor.profile.firstname% %actor.profile.lastname%');
     $this->container->setParameter('actor.profile.name', 'Jack');
     $this->container->setDefinition('actor', new Definition(static::ACTOR_CLASS, [['fistname' => '%actor.profile.firstname%', 'username' => '%actor.profile.username%']]));
     $profile = $this->container->get('actor')->getProfile();
     $this->assertEquals('Jack', $profile['fistname']);
     $this->assertEquals('Jack Chen', $profile['username']);
 }
示例#2
0
 /**
  * 派发事件
  * @param string $eventName
  * @param array $parameters
  */
 public function dispatchEvent($eventName, array $parameters = [])
 {
     $event = new Event($eventName, $this, $parameters);
     $this->container->get('dispatcher')->dispatch($eventName, $event);
 }
示例#3
0
 function initialize(Container $container)
 {
     ErrorHandler::register($container->get('log'));
 }