Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Multifactory does not work #290

@alnux

Description

@alnux

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions