/** * Gets all service ids. * * @return array An array of all defined service ids */ public function getServiceIds() { return array_unique(array_merge(array_keys($this->getServiceDefinitions()), array_keys($this->aliases), parent::getServiceIds())); }
$sc->addParameters(array('Bar' => 'fooz')); $t->is($sc->getParameters(), array('foo' => 'bar', 'bar' => 'fooz'), '->addParameters() converts keys to lowercase'); // ->setService() ->hasService() ->getService() $t->diag('->setService() ->hasService() ->getService()'); $sc = new sfServiceContainer(); $sc->setService('foo', $obj = new stdClass()); $t->is(spl_object_hash($sc->getService('foo')), spl_object_hash($obj), '->setService() registers a service under a key name'); $sc->foo1 = $obj1 = new stdClass(); $t->ok($sc->hasService('foo'), '->hasService() returns true if the service is defined'); $t->ok(!$sc->hasService('bar'), '->hasService() returns false if the service is not defined'); // ->getServiceIds() $t->diag('->getServiceIds()'); $sc = new sfServiceContainer(); $sc->setService('foo', $obj = new stdClass()); $sc->setService('bar', $obj = new stdClass()); $t->is($sc->getServiceIds(), array('service_container', 'foo', 'bar'), '->getServiceIds() returns all defined service ids'); class ProjectServiceContainer extends sfServiceContainer { public $__bar, $__foo_bar, $__foo_baz; public function __construct() { parent::__construct(); $this->__bar = new stdClass(); $this->__foo_bar = new stdClass(); $this->__foo_baz = new stdClass(); } protected function getBarService() { return $this->__bar; } protected function getFooBarService()