You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
while class 'App\Security\User\SecurityUser' implements actual UserInterface.
When I try to save the entity, it produces an error:
The class 'App\\Security\\User\\SecurityUser' was not found in the chain configured namespaces App\\Entity
Which is because of this line of code:
if (null !== $token && $this->authorizationChecker->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
$this->blameableListener->setUserValue($token->getUser());
}
$token->getUser() returns an object of class App\\Security\\User\\SecurityUser not the Entity. Is it possible to override this behavior introducing a configuration option?
The text was updated successfully, but these errors were encountered:
It is not possible without overriding BlameableListener, but additionaly you need compiler pass if you need to inject custom dependencies, for example using process function from your app kernel. You will need to inject them using setters instead of constructors because of endless loop:
/** * You can modify the container here before it is dumped to PHP code. */publicfunctionprocess(ContainerBuilder$container): void
{
$container
->getDefinition('stof_doctrine_extensions.listener.blameable')
->addMethodCall('setEntityManager', [$container->getDefinition(EntityManagerInterface::class)])
;
}
Custom blameable listener need to extend default class, example of it:
Hi, I'm using decoupled Entity and security user like it's described here https://stovepipe.systems/post/decoupling-your-security-user
The reason for that is that I want to keep domain separated following DDD principles.
Now my entity looks like:
while class 'App\Security\User\SecurityUser' implements actual UserInterface.
When I try to save the entity, it produces an error:
Which is because of this line of code:
$token->getUser()
returns an object of classApp\\Security\\User\\SecurityUser
not the Entity. Is it possible to override this behavior introducing a configuration option?The text was updated successfully, but these errors were encountered: