ReflectionException #-1 Class does not exist after update to Nette 2.4

Notice: This thread is very old.
lutor
Member | 27
+
0
-

Hi,
in our project config, we have a service defined like this:

ceneoService:
    class: Project\Control\Tracker\Component\Ceneo\Service\CeneoService
    arguments:
        - ...
        - @session::getSection('ceneoService')
        - @controlSettingsLoader::load(Project\Control\Tracker\Component\Ceneo\Conversion\CeneoConversionControl)::get('langs')

where CeneoService is service with constructor like this:

/**
 * @param Lang $lang
 * @param SessionSection $session
 * @param array $allowedLangs
 */
public function __construct(Lang $lang, SessionSection $session, array $allowedLangs)
{

(Lang is autowired).
@controlSettingsLoader is name of a service, that loads a new Settings object for given control (Settings class then have method get to access specific setting section).

With Nette 2.3 everything worked fine, but after update to Nette 2.4 we are getting “ReflectionException #-1 Class does not exist” error caused by Container builder trying to call autowireArguments with empty string: http://pasteboard.co/aAEOoGsoA.png

If I rewrite definitions of the service to separate services…

ceneoService:
    class: Project\Control\Tracker\Component\Ceneo\Service\CeneoService
    arguments:
        - ...
        - @session::getSection('ceneoService')
        - @ceneoSettings::get('langs')

ceneoSettings:
    class: Inspire\NW7\Application\Settings
    autowired: false
    create: @controlSettingsLoader::load(Project\Control\Tracker\Component\Ceneo\Conversion\CeneoConversionControl)

…it works, but it is not so handy and comfortable as it was. Is there any way, how to make the first, “short” definition to work and compile? I didn't find in changelog that format or way how to write service definitions has been changes, so maybe it is a bug?

Thanks!

David Grudl
Nette Core | 8136
+
+3
-

It doesn't know type that returns @controlSettingsLoader::load(Project\Control\Tracker\Component\Ceneo\Conversion\CeneoConversionControl), so autowiring for method get() fails. It rewritten example is type known (defined via class).

Fixed in master.