Neos\Flow\ObjectManagement\ObjectManager::buildObjectByFactory PHP 메소드

buildObjectByFactory() 보호된 메소드

Invokes the Factory defined in the object configuration of the specified object in order to build an instance. Arguments which were defined in the object configuration are passed to the factory method.
protected buildObjectByFactory ( string $objectName ) : object
$objectName string Name of the object to build
리턴 object The built object
    protected function buildObjectByFactory($objectName)
    {
        $factory = $this->get($this->objects[$objectName]['f'][0]);
        $factoryMethodName = $this->objects[$objectName]['f'][1];
        $factoryMethodArguments = [];
        foreach ($this->objects[$objectName]['fa'] as $index => $argumentInformation) {
            switch ($argumentInformation['t']) {
                case ObjectConfigurationArgument::ARGUMENT_TYPES_SETTING:
                    $settingPath = explode('.', $argumentInformation['v']);
                    $factoryMethodArguments[$index] = Arrays::getValueByPath($this->allSettings, $settingPath);
                    break;
                case ObjectConfigurationArgument::ARGUMENT_TYPES_STRAIGHTVALUE:
                    $factoryMethodArguments[$index] = $argumentInformation['v'];
                    break;
                case ObjectConfigurationArgument::ARGUMENT_TYPES_OBJECT:
                    $factoryMethodArguments[$index] = $this->get($argumentInformation['v']);
                    break;
            }
        }
        if (count($factoryMethodArguments) === 0) {
            return $factory->{$factoryMethodName}();
        } else {
            return call_user_func_array([$factory, $factoryMethodName], $factoryMethodArguments);
        }
    }