Extension factory method is not callable

4 years ago

Oggy
Member | 314
+
0
-

Hi, after updating to 2.3.7 my Texy extension stop working.

I get this error:

Nette\DI\ServiceCreationException

Factory ‘Texy\Texy::createTemplateHelpers’ used in service ‘texy.helpers’ is not callable. search►

config:

<?php
extensions:
 texy: Nette\Bridges\TexyDI\TexyExtension
?>

TexyExtensions: ..problem is on the line ..->setFactory($this->prefix(‘@texy') . '::createTemplateHelpers’)..

<?php
public function loadConfiguration()
    {
        $builder = $this->getContainerBuilder();
        $config = $this->getConfig($this->defaults);

        $this->validate($config, $this->defaults, $this->name);

        $builder->addDefinition($this->prefix('texy'))
            ->setClass('Texy\Texy');

        Validators::assertField($config, 'safeMode', 'boolean');
        if ($config['safeMode']) {
            $builder->addDefinition($this->prefix('safeConfigurator'))
                ->setClass('Texy\SafeConfigurator')
                ->addTag($this->prefix('configurator'));
        }

        $builder->addDefinition($this->prefix('helpers'))
            ->setClass('Texy\TemplateHelpers')
            ->setFactory($this->prefix('@texy') . '::createTemplateHelpers')
            ->setInject(FALSE);
    }
?>

and class Texy with not a callable method.

<?php
..
    /**
     * @return \Texy\TemplateHelpers
     */
    public function createTemplateHelpers()
    {
        return new TemplateHelpers($this);
    }
?>

It was working till the last upgrade of nette.