CreateUserController
extends AbstractController
in package
API Platform action controller triggered when a user is created.
Ensures account uniqueness within a single point of sale and synchronizes the password when the same email already exists in another POS.
Table of Contents
Methods
- __invoke() : User
- Prepares the user before persistence.
Methods
__invoke()
Prepares the user before persistence.
public
__invoke(User $user, UserPasswordHasherInterface $hasher, UserRepository $userRepository) : User
Rejects creation if an account already exists for this (email, POS) pair. If the email is already known in another POS, reuses its password hash; otherwise hashes the provided password.
Parameters
- $user : User
-
User being created (deserialized by API Platform).
- $hasher : UserPasswordHasherInterface
-
Password hashing service.
- $userRepository : UserRepository
-
Repository used for uniqueness checks.
Tags
Return values
User —The user ready to be persisted.