StandaloneUserWriteService
in package
implements
UserWriteServiceInterface
uses
EntityWriteTrait
Standalone user write service using Laravel Query Builder only.
Clean implementation without Propel references or class_exists checks. Handles the full AtoM user inheritance chain: object -> actor -> actor_i18n -> user
User extends Actor, which extends Object. All three tables plus actor_i18n must be populated when creating a user.
Table of Contents
Interfaces
- UserWriteServiceInterface
- Contract for user write operations.
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