ReservationRepository
extends BaseRepository
in package
implements
IReservationRepository
Interfaces, Classes, Traits and Enums
Table of Contents
- $cache : RepositoryCache
- $configTable : string
- $db : IDatabase
- $params : array<string|int, mixed>
- $SQL : string
- $sql : string
- SQL statement
- $SQLlimit : string
- $SQLorder : string
- $SQLwhere : string
- $table : string
- Database table name
- $pagination : Pagination
- $roomRepository : IRoomRepository
- $userRepository : IUserRepository
- __construct() : mixed
- all() : array<string|int, Model>
- reads all results of query
- byId() : Model
- Reads specific object by provided id
- create() : int
- Creates new reservation object
- delete() : void
- Deletes provided object
- deleteAllFutureUserReservations() : void
- forRoom() : void
- Read reservations for specific room
- forUser() : void
- Read reservation for specific user
- fromDate() : void
- Read reservation from given date
- one() : Model
- gets one item from collection
- orderBy() : IRepository
- Enables ordering on results
- save() : void
- Saves reservation object state
- search() : void
- Search given phrase in title and description of reservations
- setPagination() : IRepository
- Sets pagination feature enabled
- where() : IRepository
- Builds WHERE clause of query with provided data of array
- whereAddressAndBuilding() : void
- Read reservations from specific address and building
- whereAddressId() : void
- Read reservations from specific address
- whereBuildingId() : void
- Read reservations from specific building
- executeQuery() : array<string|int, mixed>
- newItem() : Reservation
- Construct reservation object from database data
Properties
$cache
protected
RepositoryCache
$cache
$configTable
protected
string
$configTable
= '`configuration`'
$db
protected
IDatabase
$db
$params
protected
array<string|int, mixed>
$params
= []
$SQL
protected
string
$SQL
$sql
SQL statement
protected
string
$sql
= ' '
$SQLlimit
protected
string
$SQLlimit
= ''
$SQLorder
protected
string
$SQLorder
= ' ORDER BY `created` DESC'
$SQLwhere
protected
string
$SQLwhere
= ' WHERE 1=1'
$table
Database table name
protected
string
$table
= '`reservation`'
$pagination
private
Pagination
$pagination
$roomRepository
private
IRoomRepository
$roomRepository
$userRepository
private
IUserRepository
$userRepository
Methods
__construct()
public
__construct(ContainerInterface $di, IRoomRepository $roomRepository, IUserRepository $userRepository) : mixed
Parameters
- $di : ContainerInterface
- $roomRepository : IRoomRepository
- $userRepository : IUserRepository
Return values
mixed —all()
reads all results of query
public
all() : array<string|int, Model>
Return values
array<string|int, Model> —byId()
Reads specific object by provided id
public
byId(int $id) : Model
Parameters
- $id : int
Return values
Model —create()
Creates new reservation object
public
create(string $title, string $description, int $room, int $user, JsonDateTime $plannedStart, JsonDateTime $plannedEnd) : int
Parameters
- $title : string
- $description : string
- $room : int
- $user : int
- $plannedStart : JsonDateTime
- $plannedEnd : JsonDateTime
Return values
int —delete()
Deletes provided object
public
delete(Reservation $reservation) : void
Parameters
- $reservation : Reservation
Tags
Return values
void —deleteAllFutureUserReservations()
public
deleteAllFutureUserReservations(int $deletedUserId) : void
Parameters
- $deletedUserId : int
Return values
void —forRoom()
Read reservations for specific room
public
forRoom(int $roomId) : void
Parameters
- $roomId : int
Return values
void —forUser()
Read reservation for specific user
public
forUser(int $userId) : void
Parameters
- $userId : int
Return values
void —fromDate()
Read reservation from given date
public
fromDate(JsonDateTime $date) : void
Parameters
- $date : JsonDateTime
Return values
void —one()
gets one item from collection
public
one() : Model
Return values
Model —orderBy()
Enables ordering on results
public
orderBy(string $name[, string $direction = 'DESC' ]) : IRepository
Parameters
- $name : string
- $direction : string = 'DESC'
Return values
IRepository —save()
Saves reservation object state
public
save(Reservation $reservation) : void
Parameters
- $reservation : Reservation
Return values
void —search()
Search given phrase in title and description of reservations
public
search(string $phrase) : void
Parameters
- $phrase : string
Return values
void —setPagination()
Sets pagination feature enabled
public
setPagination(Pagination &$pagination) : IRepository
Parameters
- $pagination : Pagination
Return values
IRepository —where()
Builds WHERE clause of query with provided data of array
public
where(array<string|int, mixed> $searchParams) : IRepository
Parameters
- $searchParams : array<string|int, mixed>
Return values
IRepository —whereAddressAndBuilding()
Read reservations from specific address and building
public
whereAddressAndBuilding(int $addressId, int $buildingId) : void
Parameters
- $addressId : int
- $buildingId : int
Return values
void —whereAddressId()
Read reservations from specific address
public
whereAddressId(int $addressId) : void
Parameters
- $addressId : int
Return values
void —whereBuildingId()
Read reservations from specific building
public
whereBuildingId(int $buildingId) : void
Parameters
- $buildingId : int
Return values
void —executeQuery()
protected
executeQuery() : array<string|int, mixed>
Return values
array<string|int, mixed> —newItem()
Construct reservation object from database data
protected
newItem(array<string|int, mixed> $data) : Reservation
Parameters
- $data : array<string|int, mixed>