Example #1
0
    /**
     * Gets the 'service_with_method_call_and_factory' service.
     *
     * This service is shared.
     * This method always returns the same instance of the service.
     *
     * @return \Bar\FooClass A Bar\FooClass instance
     */
    protected function getServiceWithMethodCallAndFactoryService()
    {
        $this->services['service_with_method_call_and_factory'] = $instance = new \Bar\FooClass();

        $instance->setBar(\Bar\FooClass::getInstance());

        return $instance;
    }
Example #2
0
 /**
  * Gets the 'service_from_static_method' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Bar\FooClass A Bar\FooClass instance.
  */
 protected function getServiceFromStaticMethodService()
 {
     return $this->services['service_from_static_method'] = \Bar\FooClass::getInstance();
 }
Example #3
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;
 }