ResourceServiceInterface
extends
DbServiceInterface
in
Database service interface for resource.
Tags
Table of Contents
- createEntity() : ResourceEntityInterface
- Create a resource entity object.
- deleteResource() : void
- Delete a resource entity.
- deleteResourceByRecordId() : bool
- Delete a resource by record id and source. Return true if found and deleted, false if not found.
- findMissingMetadata() : array<string|int, ResourceEntityInterface>
- Get a set of records that do not have metadata stored in the resource table.
- getFavorites() : array<string|int, ResourceEntityInterface>
- Get a set of resources from the requested favorite list.
- getResourceById() : ResourceEntityInterface|null
- Lookup and return a resource.
- getResourceByRecordId() : ResourceEntityInterface|null
- Retrieve a single resource row by record ID/source. Return null if it does not exist.
- getResourcesByRecordIds() : array<string|int, ResourceEntityInterface>
- Retrieve resource entities matching a set of specified records.
- persistEntity() : void
- Persist an entity.
- renameSource() : int
- Globally change the name of a source value in the database; return the number of rows affected.
Methods
createEntity()
Create a resource entity object.
public
createEntity() : ResourceEntityInterface
Return values
ResourceEntityInterface —deleteResource()
Delete a resource entity.
public
deleteResource(ResourceEntityInterface|int $resourceOrId) : void
Parameters
- $resourceOrId : ResourceEntityInterface|int
-
Resource entity or ID value.
Return values
void —deleteResourceByRecordId()
Delete a resource by record id and source. Return true if found and deleted, false if not found.
public
deleteResourceByRecordId(string $id, string $source) : bool
Throws exception if something goes wrong.
Parameters
- $id : string
-
Resource ID
- $source : string
-
Resource source
Tags
Return values
bool —findMissingMetadata()
Get a set of records that do not have metadata stored in the resource table.
public
findMissingMetadata() : array<string|int, ResourceEntityInterface>
Return values
array<string|int, ResourceEntityInterface> —getFavorites()
Get a set of resources from the requested favorite list.
public
getFavorites(UserEntityInterface|int $userOrId[, UserListEntityInterface|int|null $listOrId = null ][, array<string|int, string> $tags = [] ][, string|null $sort = null ], int $offset[, int|null $limit = null ][, bool $caseSensitiveTags = false ]) : array<string|int, ResourceEntityInterface>
Parameters
- $userOrId : UserEntityInterface|int
-
ID of user owning favorite list
- $listOrId : UserListEntityInterface|int|null = null
-
ID of list to retrieve (null for all favorites)
- $tags : array<string|int, string> = []
-
Tags to use for limiting results
- $sort : string|null = null
-
Resource table field to use for sorting (null for no particular sort).
- $offset : int
-
Offset for results
- $limit : int|null = null
-
Limit for results (null for none)
- $caseSensitiveTags : bool = false
-
Treat tags as case-sensitive?
Return values
array<string|int, ResourceEntityInterface> —getResourceById()
Lookup and return a resource.
public
getResourceById(int $id) : ResourceEntityInterface|null
Parameters
- $id : int
-
Identifier value
Return values
ResourceEntityInterface|null —getResourceByRecordId()
Retrieve a single resource row by record ID/source. Return null if it does not exist.
public
getResourceByRecordId(string $id[, string $source = DEFAULT_SEARCH_BACKEND ]) : ResourceEntityInterface|null
Parameters
- $id : string
-
Record ID
- $source : string = DEFAULT_SEARCH_BACKEND
-
Record source
Return values
ResourceEntityInterface|null —getResourcesByRecordIds()
Retrieve resource entities matching a set of specified records.
public
getResourcesByRecordIds(array<string|int, string> $ids[, string $source = DEFAULT_SEARCH_BACKEND ]) : array<string|int, ResourceEntityInterface>
Parameters
- $ids : array<string|int, string>
-
Array of IDs
- $source : string = DEFAULT_SEARCH_BACKEND
-
Source of records to look up
Return values
array<string|int, ResourceEntityInterface> —persistEntity()
Persist an entity.
public
persistEntity(EntityInterface $entity) : void
Parameters
- $entity : EntityInterface
-
Entity to persist.
Return values
void —renameSource()
Globally change the name of a source value in the database; return the number of rows affected.
public
renameSource(string $old, string $new) : int
Parameters
- $old : string
-
Old source value
- $new : string
-
New source value