Possible bug in component factories

Notice: This thread is very old.
Blujacker
Member | 89
+
0
-

While using Nette to create components using auto-generated factories, I ran into error that custom parameters (not sure how to call them, they're defined in neon file in parameters section) are not correctly passed.

In my neon, I have something like:

parameters:
    host: "mujHost"
services:
    - App\Components\TestComponentFactory(%host%)

and the component's code is:

<?php
namespace App\Components;
interface TestControlFactory{
    /** @return TestControl */
    public function create();
}

class TestControl extends \Nette\Application\UI\Control{
    private $host;
    private $database;

    function __construct($host, \Nette\Database\Context $database){
        parent::__construct();
        $this->host = $host;
        $this->database = $database;
    }
}

The error that I am getting is Class mujHost used in service ‘105_APP_Components_TestControlFactory’ not found or is not instantiable.

Is it a bug in Nette or am I doing something wrong?

Thanks!

enumag
Member | 2118
+
+3
-

Unfortunately this is a “feature”. See my pull request.

Blujacker
Member | 89
+
0
-

Thank you for that link, I am now using the syntax that works (implement, arguments). But the PR proposed by you would bring much nicer syntax!