UserWriteServiceInterface
in
Contract for user write operations.
Covers: creating users (registration), updating passwords, saving password reset tokens, and factory methods for unsaved user objects.
The PropelAdapter wraps QubitUser for Symfony mode. Falls back to Laravel Query Builder for standalone mode.
Table of Contents
Methods
- clearPasswordResetToken() : void
- Clear the password reset token for a user.
- createUser() : int
- Create a new user (register). Returns the new user ID.
- newUser() : object
- Get a new unsaved QubitUser object (for form binding in Propel mode).
- savePasswordResetToken() : void
- Save a password reset token for a user.
- updatePassword() : void
- Update user password (password reset confirm).
Methods
clearPasswordResetToken()
Clear the password reset token for a user.
public
clearPasswordResetToken(int $userId) : void
Called after a successful password reset to invalidate the token.
Parameters
- $userId : int
-
User ID
createUser()
Create a new user (register). Returns the new user ID.
public
createUser(array<string|int, mixed> $data[, string $culture = 'en' ]) : int
Data may include: email, username, password (hashed), active, groups, etc. In Propel mode, creates the full object/actor/user chain via QubitUser. In standalone mode, INSERTs into object, actor, and user tables.
Parameters
- $data : array<string|int, mixed>
-
User attributes
- $culture : string = 'en'
-
Culture code
Return values
int —The new user ID
newUser()
Get a new unsaved QubitUser object (for form binding in Propel mode).
public
newUser() : object
In Propel mode, returns a new QubitUser instance. In standalone mode, returns a stdClass.
Return values
object —Unsaved QubitUser or stdClass
savePasswordResetToken()
Save a password reset token for a user.
public
savePasswordResetToken(int $userId, string $token, string $expiry) : void
Stores the token and expiry on the user record. In Propel mode, sets properties and saves. In standalone mode, uses Laravel DB to update the user row.
Parameters
- $userId : int
-
User ID
- $token : string
-
Reset token string
- $expiry : string
-
Expiry datetime string (Y-m-d H:i:s)
updatePassword()
Update user password (password reset confirm).
public
updatePassword(int $userId, string $passwordHash) : void
In Propel mode, loads the QubitUser, calls setPassword(), and saves. In standalone mode, updates the password_hash column directly.
Parameters
- $userId : int
-
User ID
- $passwordHash : string
-
The hashed password