Programming Language PHP

Namespace Oro\Component\Config

Class ResourcesContainerInterface

Total Examples 3

3 code examples of PHP Oro\Component\Config\ResourcesContainerInterface extracted from open source projects

Was this example useful?
0
                                                    /**
     * Adds a resource objects to the container.
     * These objects will be used to monitor whether resources are up-to-date or not.
     */
    public function registerResources(ResourcesContainerInterface $resourcesContainer): void
    {
        $resourcesContainer->addResource($this->getResources());
    }
                                            
Was this example useful?
0
                                                    /**
     * @inheritdoc
     */
    public function load(AclAnnotationStorage $storage, ResourcesContainerInterface $resourcesContainer): void
    {
        $controllerActions = [];
        $controllers = $this->controllerClassProvider->getControllers();
        foreach ($controllers as list($controller, $method)) {
            $controllerActions[$controller][] = $method;
        }
        $resourcesContainer->addResource($this->controllerClassProvider->getCacheResource());

        $processedClasses = [];
        foreach ($controllerActions as $class => $methods) {
            $parentClass = null;
            $classHierarchy = $this->getClassHierarchy($class);
            foreach ($classHierarchy as $className) {
                // class already processed
                if (array_key_exists($className, $processedClasses)) {
                    continue;
                }

                $initialBindings = $storage->getBindings($className);
                $storage->removeBindings($className);

                // copy parent class annotation bindings to current class bindings
                if ($parentClass && $storage->isKnownClass($parentClass)) {
                    foreach ($storage->getBindings($parentClass) as $method => $annotationName) {
                        $storage->addBinding($annotationName, $className, $method);
                    }
                }

                $this->loadClassAnnotations($className, $storage);

                // apply initial bindings
                foreach ($initialBindings as $method => $annotationName) {
                    $storage->removeBinding($className, $method);
                    $storage->addBinding($annotationName, $className, $method);
                }

                $processedClasses[$className] = true;
                $parentClass = $className;
            }
        }
    }
                                            
Was this example useful?
0
                                                    /**
     * @inheritdoc
     */
    protected function doLoadConfig(ResourcesContainerInterface $resourcesContainer)
    {
        $config = [];
        $controllers = $this->controllerClassProvider->getControllers();
        foreach ($controllers as $routeName => list($class, $method)) {
            /** @var TitleTemplate|null $annotation */
            $annotation = $this->reader->getMethodAnnotation(
                new \ReflectionMethod($class, $method),
                TitleTemplate::class
            );
            if ($annotation) {
                $config[$routeName] = $annotation->getValue();
            }
        }
        $resourcesContainer->addResource($this->controllerClassProvider->getCacheResource());

        return $config;
    }
                                            
ResourcesContainerInterface's Other Methods
ResourcesContainerInterface's Other Methods