Ejemplo n.º 1
0
 /**
  * Loads ids for services tagged as constraint validators.
  *
  * @param TaggedContainerInterface $container The tagged service container
  */
 public function loadTaggedServiceIds(TaggedContainerInterface $container)
 {
     foreach ($container->findTaggedServiceIds('validator.constraint_validator') as $id => $attributes) {
         if (isset($attributes[0]['alias'])) {
             $this->validators[$attributes[0]['alias']] = $id;
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Loads event subscribers from the service container.
  *
  *     <service class="MySubscriber">
  *         <tag name="doctrine.odm.mongodb.event_subscriber" />
  *     </service>
  *
  * @param TaggedContainerInterface $container The service container
  * @param string $tagName The name of the tag to load
  */
 public function loadTaggedEventSubscribers(TaggedContainerInterface $container, $tagName = 'doctrine.common.event_listener')
 {
     foreach ($container->findTaggedServiceIds($tagName) as $id => $instances) {
         $this->addEventSubscriber($container->get($id));
     }
 }
 protected function assertServiceHasTag($id, $tag, $attributes = array())
 {
     $services = $this->container->findTaggedServiceIds($tag);
     $this->assertArrayHasKey($id, $services);
     $this->assertContains($attributes, $services[$id]);
 }