Пример #1
0
 /**
  * Gets the 'foo' service.
  *
  * @return FooClass A FooClass instance.
  */
 protected function getFooService()
 {
     $instance = call_user_func(array('FooClass', 'getInstance'), 'foo', $this->get('foo.baz'), array($this->getParameter('foo') => 'foo is ' . $this->getParameter('foo'), 'bar' => $this->getParameter('foo')), true, $this);
     $instance->setBar($this->get('bar'));
     $instance->initialize();
     sc_configure($instance);
     return $instance;
 }
 /**
  * Gets the 'foo' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return FooClass A FooClass instance.
  */
 protected function getFooService()
 {
     $a = $this->get('foo.baz');
     $this->services['foo'] = $instance = call_user_func(array('FooClass', 'getInstance'), 'foo', $a, array('bar' => 'foo is bar', 'foobar' => 'bar'), true, $this);
     $instance->setBar($this->get('bar'));
     $instance->initialize();
     $instance->foo = 'bar';
     $instance->moo = $a;
     sc_configure($instance);
     return $instance;
 }
Пример #3
0
 /**
  * Gets the 'foo' service.
  *
  * @return FooClass A FooClass instance.
  */
 protected function getFooService()
 {
     $a = $this->get('foo.baz');
     $instance = call_user_func(array('FooClass', 'getInstance'), 'foo', $a, array($this->getParameter('foo') => 'foo is ' . $this->getParameter('foo'), 'bar' => $this->getParameter('foo')), true, $this);
     $instance->setBar($this->get('bar'));
     $instance->initialize();
     $b = new \ReflectionProperty($instance, 'foo');
     $b->setAccessible(true);
     $b->setValue($instance, 'bar');
     $c = new \ReflectionProperty($instance, 'moo');
     $c->setAccessible(true);
     $c->setValue($instance, $a);
     sc_configure($instance);
     return $instance;
 }
Пример #4
0
 /**
  * Gets the 'foo' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Bar\FooClass A Bar\FooClass instance.
  */
 protected function getFooService()
 {
     $a = $this->get('foo.baz');
     $this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array($this->getParameter('foo') => 'foo is ' . $this->getParameter('foo') . '', 'foobar' => $this->getParameter('foo')), true, $this);
     $instance->setBar($this->get('bar'));
     $instance->initialize();
     $instance->foo = 'bar';
     $instance->moo = $a;
     $instance->qux = array($this->getParameter('foo') => 'foo is ' . $this->getParameter('foo') . '', 'foobar' => $this->getParameter('foo'));
     sc_configure($instance);
     return $instance;
 }