Documentation

DataRepository

An interface defining a DataRepository DataRepositories are utilized to perform CRUD actions on data stores

Tags
author

Jason Savell jsavell@library.tamu.edu

Table of Contents

Methods

add()  : mixed|false
Add a single record to a data store
get()  : array<string|int, mixed>
Get all records from a data source
getById()  : mixed
Get a single record by its unique ID
removeById()  : bool
Remove a single record by its unique ID
search()  : array<string|int, mixed>
Find a single record by search criteria
searchAdvanced()  : array<string|int, mixed>
Find a single record by field/value search criteria
update()  : bool
Update a single record in a store by its unique ID

Methods

add()

Add a single record to a data store

public add(mixed $data) : mixed|false
Parameters
$data : mixed

A representation of the record to be added

Return values
mixed|false

The unique ID of the record on success, false on failure

get()

Get all records from a data source

public get() : array<string|int, mixed>
Return values
array<string|int, mixed>

The results

getById()

Get a single record by its unique ID

public getById(mixed $id) : mixed
Parameters
$id : mixed

The unique ID

Return values
mixed

The record matching the ID

removeById()

Remove a single record by its unique ID

public removeById(mixed $id) : bool
Parameters
$id : mixed

The unique ID

Return values
bool

The success or failure of the update operation

Find a single record by search criteria

public search(mixed $data) : array<string|int, mixed>
Parameters
$data : mixed

The search criteria

Return values
array<string|int, mixed>

The search results

searchAdvanced()

Find a single record by field/value search criteria

public searchAdvanced(array<string, string> $data) : array<string|int, mixed>
Parameters
$data : array<string, string>

The search criteria as field/value pairs

Return values
array<string|int, mixed>

The search results

update()

Update a single record in a store by its unique ID

public update(mixed $id, mixed $data) : bool
Parameters
$id : mixed

The unique ID

$data : mixed

The search criteria

Return values
bool

Success or failure


        
On this page

Search results