Nette\DI\ContainerBuilder::findByTag PHP Method

findByTag() public method

Gets the service objects of the specified tag.
public findByTag ( $tag ) : array
return array of [service name => tag attributes]
    public function findByTag($tag)
    {
        $found = [];
        foreach ($this->definitions as $name => $def) {
            if (($tmp = $def->getTag($tag)) !== NULL) {
                $found[$name] = $tmp;
            }
        }
        return $found;
    }

Usage Example

 public function beforeCompile()
 {
     $config = $this->getConfig($this->defaults);
     $cacheDirectory = $config['cacheDir'] . "/";
     $tag = $this->prefix(static::LAZY);
     if ($config['autogenerateProxyClasses']) {
         foreach (array_keys($this->builder->findByTag($tag)) as $serviceName) {
             $this->createLazyProxy($serviceName);
         }
     } else {
         $this->proxyGenerator = new LazyLoadingValueHolderGenerator();
         foreach (array_keys($this->builder->findByTag($tag)) as $serviceName) {
             $this->createEagerProxy($serviceName, $cacheDirectory);
         }
     }
 }
All Usage Examples Of Nette\DI\ContainerBuilder::findByTag