renamed annotation to tag in the DIC

This commit is contained in:
Fabien Potencier 2010-08-05 07:34:53 +02:00
parent 8f21e5d918
commit 355ed9b5f9
33 changed files with 160 additions and 160 deletions

View File

@ -20,7 +20,7 @@
</service>
<service id="doctrine.data_collector" class="%doctrine.data_collector.class%">
<annotation name="data_collector" />
<tag name="data_collector" />
<argument type="service" id="service_container" />
</service>
</services>

View File

@ -81,7 +81,7 @@ class WebExtension extends Extension
$loader->load('collectors.xml');
}
} elseif ($container->hasDefinition('profiler')) {
$container->getDefinition('profiling')->clearAnnotations();
$container->getDefinition('profiling')->clearTags();
}
}
@ -93,7 +93,7 @@ class WebExtension extends Extension
$loader->load('toolbar.xml');
}
} elseif ($container->hasDefinition('debug.toolbar')) {
$container->getDefinition('debug.toolbar')->clearAnnotations();
$container->getDefinition('debug.toolbar')->clearTags();
}
}
@ -169,7 +169,7 @@ class WebExtension extends Extension
$loader->setArguments($arguments);
}
} elseif ($container->hasDefinition('validator')) {
$container->getDefinition('validator')->clearAnnotations();
$container->getDefinition('validator')->clearTags();
}
}
}

View File

@ -36,7 +36,7 @@ class Profiler extends BaseProfiler
protected function initCollectors()
{
$config = $this->container->findAnnotatedServiceIds('data_collector');
$config = $this->container->findTaggedServiceIds('data_collector');
$ids = array();
$coreCollectors = array();
$userCollectors = array();

View File

@ -13,22 +13,22 @@
<services>
<service id="data_collector.config" class="%data_collector.config.class%">
<annotation name="data_collector" core="true" />
<tag name="data_collector" core="true" />
<argument type="service" id="service_container" />
</service>
<service id="data_collector.app" class="%data_collector.app.class%">
<annotation name="data_collector" core="true" />
<tag name="data_collector" core="true" />
<argument type="service" id="service_container" />
</service>
<service id="data_collector.timer" class="%data_collector.timer.class%">
<annotation name="data_collector" core="true" />
<tag name="data_collector" core="true" />
<argument type="service" id="service_container" />
</service>
<service id="data_collector.memory" class="%data_collector.memory.class%">
<annotation name="data_collector" core="true" />
<tag name="data_collector" core="true" />
</service>
</services>
</container>

View File

@ -26,7 +26,7 @@
</service>
<service id="profiler_listener" class="%profiler_listener.class%">
<annotation name="kernel.listener" />
<tag name="kernel.listener" />
<argument type="service" id="profiler" />
</service>
</services>

View File

@ -19,17 +19,17 @@
</service>
<service id="routing.loader.xml" class="%routing.loader.xml.class%">
<annotation name="routing.loader" />
<tag name="routing.loader" />
<argument>%kernel.bundle_dirs%</argument>
</service>
<service id="routing.loader.yml" class="%routing.loader.yml.class%">
<annotation name="routing.loader" />
<tag name="routing.loader" />
<argument>%kernel.bundle_dirs%</argument>
</service>
<service id="routing.loader.php" class="%routing.loader.php.class%">
<annotation name="routing.loader" />
<tag name="routing.loader" />
<argument>%kernel.bundle_dirs%</argument>
</service>

View File

@ -46,43 +46,43 @@
</service>
<service id="templating.helper.javascripts" class="%templating.helper.javascripts.class%">
<annotation name="templating.helper" alias="javascripts" />
<tag name="templating.helper" alias="javascripts" />
<argument type="service" id="templating.helper.assets" />
</service>
<service id="templating.helper.stylesheets" class="%templating.helper.stylesheets.class%">
<annotation name="templating.helper" alias="stylesheets" />
<tag name="templating.helper" alias="stylesheets" />
<argument type="service" id="templating.helper.assets" />
</service>
<service id="templating.helper.slots" class="%templating.helper.slots.class%">
<annotation name="templating.helper" alias="slots" />
<tag name="templating.helper" alias="slots" />
</service>
<service id="templating.helper.assets" class="%templating.helper.assets.class%">
<annotation name="templating.helper" alias="assets" />
<tag name="templating.helper" alias="assets" />
<argument type="service" id="request" />
<argument />
<argument>%templating.assets.version%</argument>
</service>
<service id="templating.helper.request" class="%templating.helper.request.class%">
<annotation name="templating.helper" alias="request" />
<tag name="templating.helper" alias="request" />
<argument type="service" id="request" />
</service>
<service id="templating.helper.session" class="%templating.helper.session.class%">
<annotation name="templating.helper" alias="session" />
<tag name="templating.helper" alias="session" />
<argument type="service" id="request" />
</service>
<service id="templating.helper.router" class="%templating.helper.router.class%">
<annotation name="templating.helper" alias="router" />
<tag name="templating.helper" alias="router" />
<argument type="service" id="router" />
</service>
<service id="templating.helper.actions" class="%templating.helper.actions.class%">
<annotation name="templating.helper" alias="actions" />
<tag name="templating.helper" alias="actions" />
<argument type="service" id="controller_resolver" />
</service>

View File

@ -10,7 +10,7 @@
<services>
<service id="debug.toolbar" class="%debug.toolbar.class%">
<annotation name="kernel.listener" />
<tag name="kernel.listener" />
<argument type="service" id="profiler" />
</service>
</services>

View File

@ -21,7 +21,7 @@
</service>
<service id="request_listener" class="%request_listener.class%">
<annotation name="kernel.listener" />
<tag name="kernel.listener" />
<argument type="service" id="service_container" />
<argument type="service" id="router" />
<argument type="service" id="logger" on-invalid="ignore" />
@ -30,16 +30,16 @@
<service id="esi" class="%esi.class%" />
<service id="esi_listener" class="%esi_listener.class%">
<annotation name="kernel.listener" />
<tag name="kernel.listener" />
<argument type="service" id="esi" on-invalid="ignore" />
</service>
<service id="response_listener" class="%response_listener.class%">
<annotation name="kernel.listener" />
<tag name="kernel.listener" />
</service>
<service id="exception_listener" class="%exception_listener.class%">
<annotation name="kernel.listener" />
<tag name="kernel.listener" />
<argument type="service" id="service_container" />
<argument type="service" id="logger" on-invalid="null" />
<argument>%exception_listener.controller%</argument>

View File

@ -39,7 +39,7 @@ class LoaderResolver extends BaseLoaderResolver
parent::__construct($loaders);
$this->container = $container;
foreach ($container->findAnnotatedServiceIds('routing.loader') as $id => $attributes) {
foreach ($container->findTaggedServiceIds('routing.loader') as $id => $attributes) {
$this->services[] = $id;
}
}

View File

@ -42,7 +42,7 @@ class Engine extends BaseEngine
$this->container = $container;
$this->escaper = $escaper;
foreach ($this->container->findAnnotatedServiceIds('templating.renderer') as $id => $attributes) {
foreach ($this->container->findTaggedServiceIds('templating.renderer') as $id => $attributes) {
if (isset($attributes[0]['alias'])) {
$renderers[$attributes[0]['alias']] = $this->container->get($id);
}
@ -51,7 +51,7 @@ class Engine extends BaseEngine
parent::__construct($loader, $renderers);
$this->helpers = array();
foreach ($this->container->findAnnotatedServiceIds('templating.helper') as $id => $attributes) {
foreach ($this->container->findTaggedServiceIds('templating.helper') as $id => $attributes) {
if (isset($attributes[0]['alias'])) {
$this->helpers[$attributes[0]['alias']] = $id;
}

View File

@ -24,7 +24,7 @@ class Environment extends \Twig_Environment
{
parent::__construct($loader, $options);
foreach ($container->findAnnotatedServiceIds('twig.extension') as $id => $attributes) {
foreach ($container->findTaggedServiceIds('twig.extension') as $id => $attributes) {
$this->addExtension($container->get($id));
}
}

View File

@ -29,16 +29,16 @@
</service>
<service id="twig.renderer" class="%twig.renderer.class%">
<annotation name="templating.renderer" alias="twig" />
<tag name="templating.renderer" alias="twig" />
<argument type="service" id="twig" />
</service>
<service id="twig.extension.escaper" class="Twig_Extension_Escaper">
<annotation name="twig.extension" />
<tag name="twig.extension" />
</service>
<service id="twig.extension.helpers" class="Symfony\Bundle\TwigBundle\Extension\Helpers">
<annotation name="twig.extension" />
<tag name="twig.extension" />
</service>
</services>
</container>

View File

@ -20,7 +20,7 @@ use Symfony\Components\DependencyInjection\Resource\FileResource;
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class ContainerBuilder extends Container implements AnnotatedContainerInterface
class ContainerBuilder extends Container implements TaggedContainerInterface
{
static protected $extensions = array();
@ -570,22 +570,22 @@ class ContainerBuilder extends Container implements AnnotatedContainerInterface
}
/**
* Returns service ids for a given annotation.
* Returns service ids for a given tag.
*
* @param string $name The annotation name
* @param string $name The tag name
*
* @return array An array of annotations
* @return array An array of tags
*/
public function findAnnotatedServiceIds($name)
public function findTaggedServiceIds($name)
{
$annotations = array();
$tags = array();
foreach ($this->getDefinitions() as $id => $definition) {
if ($definition->getAnnotation($name)) {
$annotations[$id] = $definition->getAnnotation($name);
if ($definition->getTag($name)) {
$tags[$id] = $definition->getTag($name);
}
}
return $annotations;
return $tags;
}
static public function getServiceConditionals($value)

View File

@ -26,7 +26,7 @@ class Definition
protected $arguments;
protected $calls;
protected $configurator;
protected $annotations;
protected $tags;
/**
* Constructor.
@ -40,7 +40,7 @@ class Definition
$this->arguments = $arguments;
$this->calls = array();
$this->shared = true;
$this->annotations = array();
$this->tags = array();
}
/**
@ -196,58 +196,58 @@ class Definition
}
/**
* Returns all annotations.
* Returns all tags.
*
* @return array An array of annotations
* @return array An array of tags
*/
public function getAnnotations()
public function getTags()
{
return $this->annotations;
return $this->tags;
}
/**
* Gets an annotation by name.
* Gets a tag by name.
*
* @param string $name The annotation name
* @param string $name The tag name
*
* @return array An array of attributes
*/
public function getAnnotation($name)
public function getTag($name)
{
if (!isset($this->annotations[$name])) {
$this->annotations[$name] = array();
if (!isset($this->tags[$name])) {
$this->tags[$name] = array();
}
return $this->annotations[$name];
return $this->tags[$name];
}
/**
* Adds an annotation for this definition.
* Adds a tag for this definition.
*
* @param string $name The annotation name
* @param string $name The tag name
* @param array $attributes An array of attributes
*
* @return Definition The current instance
*/
public function addAnnotation($name, array $attributes = array())
public function addTag($name, array $attributes = array())
{
if (!isset($this->annotations[$name])) {
$this->annotations[$name] = array();
if (!isset($this->tags[$name])) {
$this->tags[$name] = array();
}
$this->annotations[$name][] = $attributes;
$this->tags[$name][] = $attributes;
return $this;
}
/**
* Clears the annotation for this definition.
* Clears the tags for this definition.
*
* @return Definition The current instance
*/
public function clearAnnotations()
public function clearTags()
{
$this->annotations = array();
$this->tags = array();
return $this;
}

View File

@ -47,7 +47,7 @@ class PhpDumper extends Dumper
$this->startClass($options['class'], $options['base_class']).
$this->addConstructor().
$this->addServices().
$this->addAnnotations().
$this->addTags().
$this->addDefaultParametersMethod().
$this->endClass()
;
@ -229,34 +229,34 @@ EOF;
return $code;
}
protected function addAnnotations()
protected function addTags()
{
$annotations = array();
$tags = array();
foreach ($this->container->getDefinitions() as $id => $definition) {
foreach ($definition->getAnnotations() as $name => $ann) {
if (!isset($annotations[$name])) {
$annotations[$name] = array();
foreach ($definition->getTags() as $name => $ann) {
if (!isset($tags[$name])) {
$tags[$name] = array();
}
$annotations[$name][$id] = $ann;
$tags[$name][$id] = $ann;
}
}
$annotations = var_export($annotations, true);
$tags = var_export($tags, true);
return <<<EOF
/**
* Returns service ids for a given annotation.
* Returns service ids for a given tag.
*
* @param string \$name The annotation name
* @param string \$name The tag name
*
* @return array An array of annotations
* @return array An array of tags
*/
public function findAnnotatedServiceIds(\$name)
public function findTaggedServiceIds(\$name)
{
static \$annotations = $annotations;
static \$tags = $tags;
return isset(\$annotations[\$name]) ? \$annotations[\$name] : array();
return isset(\$tags[\$name]) ? \$tags[\$name] : array();
}
EOF;

View File

@ -59,15 +59,15 @@ class XmlDumper extends Dumper
!$definition->isShared() ? ' shared="false"' : ''
);
foreach ($definition->getAnnotations() as $name => $annotations) {
foreach ($annotations as $attributes) {
foreach ($definition->getTags() as $name => $tags) {
foreach ($tags as $attributes) {
$att = array();
foreach ($attributes as $key => $value) {
$att[] = sprintf('%s="%s"', $key, $value);
}
$att = $att ? ' '.implode(' ', $att) : '';
$code .= sprintf(" <annotation name=\"%s\"%s />\n", $name, $att);
$code .= sprintf(" <tag name=\"%s\"%s />\n", $name, $att);
}
}

View File

@ -42,20 +42,20 @@ class YamlDumper extends Dumper
$code .= sprintf(" class: %s\n", $definition->getClass());
}
$annotationsCode = '';
foreach ($definition->getAnnotations() as $name => $annotations) {
foreach ($annotations as $attributes) {
$tagsCode = '';
foreach ($definition->getTags() as $name => $tags) {
foreach ($tags as $attributes) {
$att = array();
foreach ($attributes as $key => $value) {
$att[] = sprintf('%s: %s', Yaml::dump($key), Yaml::dump($value));
}
$att = $att ? ', '.implode(' ', $att) : '';
$annotationsCode .= sprintf(" - { name: %s%s }\n", Yaml::dump($name), $att);
$tagsCode .= sprintf(" - { name: %s%s }\n", Yaml::dump($name), $att);
}
}
if ($annotationsCode) {
$code .= " annotations:\n".$annotationsCode;
if ($tagsCode) {
$code .= " tags:\n".$tagsCode;
}
if ($definition->getFile()) {

View File

@ -138,9 +138,9 @@ class XmlFileLoader extends FileLoader
$definition->addMethodCall((string) $call['method'], $call->getArgumentsAsPhp('argument'));
}
foreach ($service->annotation as $annotation) {
foreach ($service->tag as $tag) {
$parameters = array();
foreach ($annotation->attributes() as $name => $value) {
foreach ($tag->attributes() as $name => $value) {
if ('name' === $name) {
continue;
}
@ -148,7 +148,7 @@ class XmlFileLoader extends FileLoader
$parameters[$name] = SimpleXMLElement::phpize($value);
}
$definition->addAnnotation((string) $annotation['name'], $parameters);
$definition->addTag((string) $tag['name'], $parameters);
}
$this->container->setDefinition($id, $definition);

View File

@ -144,12 +144,12 @@ class YamlFileLoader extends FileLoader
}
}
if (isset($service['annotations'])) {
foreach ($service['annotations'] as $annotation) {
$name = $annotation['name'];
unset($annotation['name']);
if (isset($service['tags'])) {
foreach ($service['tags'] as $tag) {
$name = $tag['name'];
unset($tag['name']);
$definition->addAnnotation($name, $annotation);
$definition->addTag($name, $tag);
}
}

View File

@ -84,7 +84,7 @@
<xsd:element name="argument" type="argument" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="configurator" type="configurator" minOccurs="0" maxOccurs="1" />
<xsd:element name="call" type="call" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="annotation" type="annotation" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="tag" type="tag" minOccurs="0" maxOccurs="unbounded" />
</xsd:choice>
<xsd:attribute name="id" type="xsd:string" />
<xsd:attribute name="class" type="xsd:string" />
@ -94,7 +94,7 @@
<xsd:attribute name="alias" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="annotation">
<xsd:complexType name="tag">
<xsd:attribute name="name" type="xsd:string" />
<xsd:anyAttribute namespace="##any" processContents="lax" />
</xsd:complexType>

View File

@ -12,18 +12,18 @@ namespace Symfony\Components\DependencyInjection;
*/
/**
* AnnotatedContainerInterface is the interface implemented when a container knows how to deals with annotations.
* TaggedContainerInterface is the interface implemented when a container knows how to deals with tags.
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
interface AnnotatedContainerInterface
interface TaggedContainerInterface
{
/**
* Returns service ids for a given annotation.
* Returns service ids for a given tag.
*
* @param string $name The annotation name
* @param string $name The tag name
*
* @return array An array of annotations
* @return array An array of tags
*/
public function findAnnotatedServiceIds($name);
public function findTaggedServiceIds($name);
}

View File

@ -28,7 +28,7 @@ class EventDispatcher extends BaseEventDispatcher
*/
public function __construct(ContainerInterface $container)
{
foreach ($container->findAnnotatedServiceIds('kernel.listener') as $id => $attributes) {
foreach ($container->findTaggedServiceIds('kernel.listener') as $id => $attributes) {
$container->get($id)->register($this);
}
}

View File

@ -207,7 +207,7 @@ class KernelExtension extends Extension
$container->setParameter('session.class', $config['class']);
}
foreach (array('name', 'auto_start', 'lifetime', 'path', 'domain', 'secure', 'httponly', 'cache_limiter', 'pdo.db_table') as $name) {
foreach (array('name', 'lifetime', 'path', 'domain', 'secure', 'httponly', 'cache_limiter', 'pdo.db_table') as $name) {
if (isset($config['session'][$name])) {
$container->setParameter('session.options.'.$name, $config['session'][$name]);
}
@ -438,7 +438,7 @@ class EventDispatcher extends BaseEventDispatcher
public function __construct(ContainerInterface $container)
{
foreach ($container->findAnnotatedServiceIds('kernel.listener') as $id => $attributes) {
foreach ($container->findTaggedServiceIds('kernel.listener') as $id => $attributes) {
$container->get($id)->register($this);
}
}

View File

@ -341,24 +341,24 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Symfony\Components\DependencyInjection\ContainerBuilder::findAnnotatedServiceIds
* @covers Symfony\Components\DependencyInjection\ContainerBuilder::findTaggedServiceIds
*/
public function testFindAnnotatedServiceIds()
public function testfindTaggedServiceIds()
{
$builder = new ContainerBuilder();
$builder
->register('foo', 'FooClass')
->addAnnotation('foo', array('foo' => 'foo'))
->addAnnotation('bar', array('bar' => 'bar'))
->addAnnotation('foo', array('foofoo' => 'foofoo'))
->addTag('foo', array('foo' => 'foo'))
->addTag('bar', array('bar' => 'bar'))
->addTag('foo', array('foofoo' => 'foofoo'))
;
$this->assertEquals($builder->findAnnotatedServiceIds('foo'), array(
$this->assertEquals($builder->findTaggedServiceIds('foo'), array(
'foo' => array(
array('foo' => 'foo'),
array('foofoo' => 'foofoo'),
)
), '->findAnnotatedServiceIds() returns an array of service ids and its annotation attributes');
$this->assertEquals(array(), $builder->findAnnotatedServiceIds('foobar'), '->findAnnotatedServiceIds() returns an empty array if there is annotated services');
), '->findTaggedServiceIds() returns an array of service ids and its tag attributes');
$this->assertEquals(array(), $builder->findTaggedServiceIds('foobar'), '->findTaggedServiceIds() returns an empty array if there is annotated services');
}
/**

View File

@ -118,34 +118,34 @@ class DefinitionTest extends \PHPUnit_Framework_TestCase
}
/**
* @covers Symfony\Components\DependencyInjection\Definition::clearAnnotations
* @covers Symfony\Components\DependencyInjection\Definition::clearTags
*/
public function testClearAnnotations()
public function testClearTags()
{
$def = new Definition('stdClass');
$this->assertEquals(spl_object_hash($def), spl_object_hash($def->clearAnnotations()), '->clearAnnotations() implements a fluent interface');
$def->addAnnotation('foo', array('foo' => 'bar'));
$def->clearAnnotations();
$this->assertEquals(array(), $def->getAnnotations(), '->clearAnnotations() removes all current annotations');
$this->assertEquals(spl_object_hash($def), spl_object_hash($def->clearTags()), '->clearTags() implements a fluent interface');
$def->addTag('foo', array('foo' => 'bar'));
$def->clearTags();
$this->assertEquals(array(), $def->getTags(), '->clearTags() removes all current tags');
}
/**
* @covers Symfony\Components\DependencyInjection\Definition::addAnnotation
* @covers Symfony\Components\DependencyInjection\Definition::getAnnotation
* @covers Symfony\Components\DependencyInjection\Definition::getAnnotations
* @covers Symfony\Components\DependencyInjection\Definition::addTag
* @covers Symfony\Components\DependencyInjection\Definition::getTag
* @covers Symfony\Components\DependencyInjection\Definition::getTags
*/
public function testAnnotations()
public function testTags()
{
$def = new Definition('stdClass');
$this->assertEquals(array(), $def->getAnnotation('foo'), '->getAnnotation() returns an empty array if the annotation is not defined');
$this->assertEquals(spl_object_hash($def), spl_object_hash($def->addAnnotation('foo')), '->addAnnotation() implements a fluent interface');
$this->assertEquals(array(array()), $def->getAnnotation('foo'), '->getAnnotation() returns attributes for an annotation name');
$def->addAnnotation('foo', array('foo' => 'bar'));
$this->assertEquals(array(array(), array('foo' => 'bar')), $def->getAnnotation('foo'), '->addAnnotation() can adds the same annotation several times');
$def->addAnnotation('bar', array('bar' => 'bar'));
$this->assertEquals($def->getAnnotations(), array(
$this->assertEquals(array(), $def->getTag('foo'), '->getTag() returns an empty array if the tag is not defined');
$this->assertEquals(spl_object_hash($def), spl_object_hash($def->addTag('foo')), '->addTag() implements a fluent interface');
$this->assertEquals(array(array()), $def->getTag('foo'), '->getTag() returns attributes for a tag name');
$def->addTag('foo', array('foo' => 'bar'));
$this->assertEquals(array(array(), array('foo' => 'bar')), $def->getTag('foo'), '->addTag() can adds the same tag several times');
$def->addTag('bar', array('bar' => 'bar'));
$this->assertEquals($def->getTags(), array(
'foo' => array(array(), array('foo' => 'bar')),
'bar' => array(array('bar' => 'bar')),
), '->getAnnotations() returns all annotations');
), '->getTags() returns all tags');
}
}

View File

@ -10,8 +10,8 @@ use Symfony\Components\DependencyInjection\Parameter;
$container = new ContainerBuilder();
$container->
register('foo', 'FooClass')->
addAnnotation('foo', array('foo' => 'foo'))->
addAnnotation('foo', array('bar' => 'bar'))->
addTag('foo', array('foo' => 'foo'))->
addTag('foo', array('bar' => 'bar'))->
setFactoryMethod('getInstance')->
setArguments(array('foo', new Reference('foo.baz'), array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, new Reference('service_container')))->
setFile(realpath(__DIR__.'/../includes/foo.php'))->

View File

@ -25,17 +25,17 @@ class Container extends AbstractContainer
}
/**
* Returns service ids for a given annotation.
* Returns service ids for a given tag.
*
* @param string $name The annotation name
* @param string $name The tag name
*
* @return array An array of annotations
* @return array An array of tags
*/
public function findAnnotatedServiceIds($name)
public function findTaggedServiceIds($name)
{
static $annotations = array (
static $tags = array (
);
return isset($annotations[$name]) ? $annotations[$name] : array();
return isset($tags[$name]) ? $tags[$name] : array();
}
}

View File

@ -25,17 +25,17 @@ class ProjectServiceContainer extends Container
}
/**
* Returns service ids for a given annotation.
* Returns service ids for a given tag.
*
* @param string $name The annotation name
* @param string $name The tag name
*
* @return array An array of annotations
* @return array An array of tags
*/
public function findAnnotatedServiceIds($name)
public function findTaggedServiceIds($name)
{
static $annotations = array (
static $tags = array (
);
return isset($annotations[$name]) ? $annotations[$name] : array();
return isset($tags[$name]) ? $tags[$name] : array();
}
}

View File

@ -25,18 +25,18 @@ class ProjectServiceContainer extends Container
}
/**
* Returns service ids for a given annotation.
* Returns service ids for a given tag.
*
* @param string $name The annotation name
* @param string $name The tag name
*
* @return array An array of annotations
* @return array An array of tags
*/
public function findAnnotatedServiceIds($name)
public function findTaggedServiceIds($name)
{
static $annotations = array (
static $tags = array (
);
return isset($annotations[$name]) ? $annotations[$name] : array();
return isset($tags[$name]) ? $tags[$name] : array();
}
/**

View File

@ -153,15 +153,15 @@ class ProjectServiceContainer extends Container
}
/**
* Returns service ids for a given annotation.
* Returns service ids for a given tag.
*
* @param string $name The annotation name
* @param string $name The tag name
*
* @return array An array of annotations
* @return array An array of tags
*/
public function findAnnotatedServiceIds($name)
public function findTaggedServiceIds($name)
{
static $annotations = array (
static $tags = array (
'foo' =>
array (
'foo' =>
@ -178,7 +178,7 @@ class ProjectServiceContainer extends Container
),
);
return isset($annotations[$name]) ? $annotations[$name] : array();
return isset($tags[$name]) ? $tags[$name] : array();
}
/**

View File

@ -10,8 +10,8 @@
</parameters>
<services>
<service id="foo" class="FooClass" factory-method="getInstance" shared="false">
<annotation name="foo" foo="foo" />
<annotation name="foo" bar="bar" />
<tag name="foo" foo="foo" />
<tag name="foo" bar="bar" />
<file>%path%foo.php</file>
<argument>foo</argument>
<argument type="service" id="foo.baz" />

View File

@ -6,7 +6,7 @@ parameters:
services:
foo:
class: FooClass
annotations:
tags:
- { name: foo, foo: foo }
- { name: foo, bar: bar }
file: %path%foo.php