UserCardServiceInterface
extends
DbServiceInterface
in
Database service for UserCard.
Tags
Table of Contents
- activateLibraryCard() : void
- Activate a library card for the given username.
- createEntity() : UserCardEntityInterface
- Create a UserCard entity object.
- deleteLibraryCard() : bool
- Delete library card.
- getAllRowsWithUsernames() : array<string|int, UserCardEntityInterface>
- Get user_card rows with catalog usernames set.
- getInsecureRows() : array<string|int, UserCardEntityInterface>
- Get user_card rows with insecure catalog passwords.
- getLibraryCards() : array<string|int, UserCardEntityInterface>
- Get all library cards associated with the user.
- getOrCreateLibraryCard() : UserCardEntityInterface
- Get or create library card data.
- persistEntity() : void
- Persist an entity.
- persistLibraryCardData() : UserCardEntityInterface
- Persist the provided library card data, either by updating a specified card or by creating a new one (when $card is null). Also updates the primary user row when appropriate. Will throw an exception if a duplicate $username value is provided; there should only be one card row per username.
- synchronizeUserLibraryCardData() : bool
- Verify that the user's current ILS settings exist in their library card data (if enabled) and are up to date. Designed to be called after updating the user row; will create or modify library card rows as needed.
Methods
activateLibraryCard()
Activate a library card for the given username.
public
activateLibraryCard(UserEntityInterface|int $userOrId, int $id) : void
Parameters
- $userOrId : UserEntityInterface|int
-
User owning card
- $id : int
-
Library card ID to activate
Tags
Return values
void —createEntity()
Create a UserCard entity object.
public
createEntity() : UserCardEntityInterface
Return values
UserCardEntityInterface —deleteLibraryCard()
Delete library card.
public
deleteLibraryCard(UserEntityInterface $user, UserCardEntityInterface|int $userCard) : bool
Parameters
- $user : UserEntityInterface
-
User owning card to delete
- $userCard : UserCardEntityInterface|int
-
UserCard id or object to be deleted
Tags
Return values
bool —getAllRowsWithUsernames()
Get user_card rows with catalog usernames set.
public
getAllRowsWithUsernames() : array<string|int, UserCardEntityInterface>
Return values
array<string|int, UserCardEntityInterface> —getInsecureRows()
Get user_card rows with insecure catalog passwords.
public
getInsecureRows() : array<string|int, UserCardEntityInterface>
Return values
array<string|int, UserCardEntityInterface> —getLibraryCards()
Get all library cards associated with the user.
public
getLibraryCards(UserEntityInterface|int $userOrId[, int|null $id = null ][, string|null $catUsername = null ]) : array<string|int, UserCardEntityInterface>
Parameters
- $userOrId : UserEntityInterface|int
-
User object or identifier
- $id : int|null = null
-
Optional card ID filter
- $catUsername : string|null = null
-
Optional catalog username filter
Return values
array<string|int, UserCardEntityInterface> —getOrCreateLibraryCard()
Get or create library card data.
public
getOrCreateLibraryCard(UserEntityInterface|int $userOrId[, int|null $id = null ]) : UserCardEntityInterface
Parameters
- $userOrId : UserEntityInterface|int
-
User object or identifier
- $id : int|null = null
-
Card ID to fetch (or null to create a new card)
Tags
Return values
UserCardEntityInterface —Card data if found; throws exception otherwise
persistEntity()
Persist an entity.
public
persistEntity(EntityInterface $entity) : void
Parameters
- $entity : EntityInterface
-
Entity to persist.
Return values
void —persistLibraryCardData()
Persist the provided library card data, either by updating a specified card or by creating a new one (when $card is null). Also updates the primary user row when appropriate. Will throw an exception if a duplicate $username value is provided; there should only be one card row per username.
public
persistLibraryCardData(UserEntityInterface|int $userOrId, UserCardEntityInterface|int|null $cardOrId, string $cardName, string $username, string $password[, string $homeLib = '' ]) : UserCardEntityInterface
Returns the row that was added or updated.
Parameters
- $userOrId : UserEntityInterface|int
-
User object or identifier
- $cardOrId : UserCardEntityInterface|int|null
-
Card ID (null = create new)
- $cardName : string
-
Card name
- $username : string
-
Username
- $password : string
-
Password
- $homeLib : string = ''
-
Home Library
Tags
Return values
UserCardEntityInterface —synchronizeUserLibraryCardData()
Verify that the user's current ILS settings exist in their library card data (if enabled) and are up to date. Designed to be called after updating the user row; will create or modify library card rows as needed.
public
synchronizeUserLibraryCardData(UserEntityInterface|int $userOrId) : bool
Parameters
- $userOrId : UserEntityInterface|int
-
User object or identifier