DataModelInterface
in
Data model interface
Tags
Table of Contents
Methods
- count() : int
- Get count
- create() : mixed
- Create
- delete() : int
- Delete
- describe() : array<string|int, mixed>
- Method to describe columns in the database table
- filter() : DataModelInterface
- Set filters
- getAll() : array<string|int, mixed>|Collection
- Get all
- getById() : array<string|int, mixed>|Record
- Get by ID
- getOffsetAndLimit() : array<string|int, mixed>
- Get offset and limit
- getOrderBy() : string|array<string|int, mixed>|null
- Get order by
- getPrimaryId() : string
- Get table primary ID
- getTableClass() : string
- Get table class
- hasRequirements() : bool
- Method to check if model has requirements or validations
- parseFilter() : array<string|int, mixed>
- Method to parse filter for select predicates
- remove() : int
- Remove multiple
- replace() : mixed
- Replace
- select() : DataModelInterface
- Set select columns
- update() : mixed
- Update
- validate() : bool|array<string|int, mixed>
- Method to validate model data
Methods
count()
Get count
public
count() : int
Tags
Return values
intcreate()
Create
public
create(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
delete()
Delete
public
delete(mixed $id) : int
Parameters
- $id : mixed
Tags
Return values
intdescribe()
Method to describe columns in the database table
public
describe([bool $native = false ][, bool $full = false ]) : array<string|int, mixed>
Parameters
- $native : bool = false
-
Show the native columns in the table
- $full : bool = false
-
Used with the native flag, returns array of "column" => "type"
Tags
Return values
array<string|int, mixed>filter()
Set filters
public
filter([mixed $filters = null ][, mixed $select = null ]) : DataModelInterface
Parameters
- $filters : mixed = null
- $select : mixed = null
Return values
DataModelInterfacegetAll()
Get all
public
getAll([string|null $sort = null ][, mixed $limit = null ][, mixed $page = null ][, bool|array<string|int, mixed> $toArray = false ]) : array<string|int, mixed>|Collection
Parameters
- $sort : string|null = null
- $limit : mixed = null
- $page : mixed = null
- $toArray : bool|array<string|int, mixed> = false
Tags
Return values
array<string|int, mixed>|CollectiongetById()
Get by ID
public
getById(mixed $id[, bool $toArray = false ]) : array<string|int, mixed>|Record
Parameters
- $id : mixed
- $toArray : bool = false
Tags
Return values
array<string|int, mixed>|RecordgetOffsetAndLimit()
Get offset and limit
public
getOffsetAndLimit([mixed $page = null ][, mixed $limit = null ]) : array<string|int, mixed>
Parameters
- $page : mixed = null
- $limit : mixed = null
Return values
array<string|int, mixed>getOrderBy()
Get order by
public
getOrderBy([mixed $sort = null ][, bool $toArray = false ]) : string|array<string|int, mixed>|null
Parameters
- $sort : mixed = null
- $toArray : bool = false
Return values
string|array<string|int, mixed>|nullgetPrimaryId()
Get table primary ID
public
getPrimaryId() : string
Return values
stringgetTableClass()
Get table class
public
getTableClass() : string
Return values
stringhasRequirements()
Method to check if model has requirements or validations
public
hasRequirements() : bool
Return values
boolparseFilter()
Method to parse filter for select predicates
public
parseFilter(mixed $filter) : array<string|int, mixed>
Parameters
- $filter : mixed
Return values
array<string|int, mixed>remove()
Remove multiple
public
remove(array<string|int, mixed> $ids) : int
Parameters
- $ids : array<string|int, mixed>
Tags
Return values
intreplace()
Replace
public
replace(mixed $id, array<string|int, mixed> $data) : mixed
Parameters
- $id : mixed
- $data : array<string|int, mixed>
select()
Set select columns
public
select([mixed $select = null ]) : DataModelInterface
Parameters
- $select : mixed = null
Return values
DataModelInterfaceupdate()
Update
public
update(mixed $id, array<string|int, mixed> $data) : mixed
Parameters
- $id : mixed
- $data : array<string|int, mixed>
validate()
Method to validate model data
public
validate(array<string|int, mixed> $data) : bool|array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>