UserRepositoryInterface
in
Describes user repository behavior
Table of Contents
Methods
- add() : int
- Persists a new user entity.
- delete() : bool
- Deletes a user by its ID.
- findAll() : array<string|int, User>
- Retrieves all users from storage.
- findByExactUsername() : User|null
- Finds a user by exact username match.
- findById() : User
- Finds a user by its ID.
- findByUsernamePartial() : array<string|int, User>
- Finds a user by partial username match.
- update() : bool
- Updates an existing user entity.
- updatePassword() : bool
- Updates user password hash.
Methods
add()
Persists a new user entity.
public
add(User $user) : int
Parameters
- $user : User
-
The user entity to add
Tags
Return values
int —user id
delete()
Deletes a user by its ID.
public
delete(int $id) : bool
Parameters
- $id : int
-
The user ID to delete
Tags
Return values
bool —True if deletion was successful, false otherwise
findAll()
Retrieves all users from storage.
public
findAll() : array<string|int, User>
Tags
Return values
array<string|int, User> —Array of all user entities
findByExactUsername()
Finds a user by exact username match.
public
findByExactUsername(string $username) : User|null
Parameters
- $username : string
-
The username to search for
Tags
Return values
User|null —The user entity or null if not found
findById()
Finds a user by its ID.
public
findById(int $id) : User
Parameters
- $id : int
-
The user ID
Tags
Return values
User —The user entity
findByUsernamePartial()
Finds a user by partial username match.
public
findByUsernamePartial(string $username) : array<string|int, User>
Parameters
- $username : string
-
The partial username to search for
Tags
Return values
array<string|int, User> —Array of matching user entities
update()
Updates an existing user entity.
public
update(User $user) : bool
Parameters
- $user : User
-
The user entity with updated data
Tags
Return values
bool —True if update was successful, false otherwise
updatePassword()
Updates user password hash.
public
updatePassword(int $id, string $newPasswordHash) : bool
Parameters
- $id : int
-
The user ID
- $newPasswordHash : string
-
The new password hash
Tags
Return values
bool —True if update was successful, false otherwise