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']); }
/** * 派发事件 * @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); }
function initialize(Container $container) { ErrorHandler::register($container->get('log')); }