Skip to content

General User service shadows Carrooi User in DI #13

@jspetrak

Description

@jspetrak

I have just started to try the component, added the extension and now I am hitting:

Unable to create service 'security.user', value returned by factory is not Carrooi\Security\User\User type.

I reviewed the generator container code and see following code, that cannot pass. It creates a parent User class, and then checks type for child User class.

Have I missed some step?

public function createServiceSecurity__user(): Carrooi\Security\User\User
	{
		$service = new Nette\Security\User($this->getService('security.userStorage'), $this->getService('authenticator'));
		if (!$service instanceof Carrooi\Security\User\User) {
			throw new Nette\UnexpectedValueException('Unable to create service \'security.user\', value returned by factory is not Carrooi\Security\User\User type.');
		}
		$this->getService('tracy.bar')->addPanel(new Nette\Bridges\SecurityTracy\UserPanel($service));
		$service->onLoggedIn = $this->getService('events.manager')->createEvent(['Carrooi\Security\User\User', 'onLoggedIn'], $service->onLoggedIn, null, false);
		$service->onLoggedOut = $this->getService('events.manager')->createEvent(['Carrooi\Security\User\User', 'onLoggedOut'], $service->onLoggedOut, null, false);
		return $service;
	}

And the types array contains also both:

'Nette\Security\User' => [1 => ['security.user']],
'Carrooi\Security\User\User' => [1 => ['security.user']],

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions