Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multifactory does not work #290

Open
alnux opened this issue Jul 30, 2023 · 0 comments
Open

Multifactory does not work #290

alnux opened this issue Jul 30, 2023 · 0 comments

Comments

@alnux
Copy link

alnux commented Jul 30, 2023

Nette Di 3.1.2

Bug Description

... The multifactory create does not work showing that must have just one non-static method get()

Steps To Reproduce

applying the example of the multifactory documentation, this returns me that I have to have a get method, reference nette forum

User Model

declare(strict_types=1);
namespace App\Modules\Admin\User\Model;

use Nette;

final class User {
	protected $user;

    public function __construct(private Nette\Database\Explorer $db,) {
        $this->user = 'user'; 
	}

	public function all() {
		return  $this->db->table($this->user)->where('active = ? AND deleted = ?',1,0); 
	}
}

UsersModelFactory

declare(strict_types=1);
namespace App\Modules\Admin\User\Model;

use App\Modules\Admin\User\Model\User;
use App\Modules\Admin\User\Model\Prube;

interface UserModelsFactory {
    function createUser(): User;
    function createPrube(): Prube; // another model like user
}

neon file

services:
	- App\Modules\Admin\User\Model\UserModelsFactory

the result is tracy showing error 500 with the message
Service '02': Interface App\Modules\Admin\User\Model\UserModelsFactory must have just one non-static method get()

Expected Behavior

The same result with unitary factories interface where the create function is called

Possible Solution

... sorry not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant