Documentation

DataModelInterface
in

Data model interface

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
4.2.0

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

create()

Create

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

describe()

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
throws
Exception
Return values
array<string|int, mixed>

getAll()

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
throws
Exception
Return values
array<string|int, mixed>|Collection

getById()

Get by ID

public getById(mixed $id[, bool $toArray = false ]) : array<string|int, mixed>|Record
Parameters
$id : mixed
$toArray : bool = false
Tags
throws
Exception
Return values
array<string|int, mixed>|Record

getOffsetAndLimit()

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>|null

getPrimaryId()

Get table primary ID

public getPrimaryId() : string
Return values
string

getTableClass()

Get table class

public getTableClass() : string
Return values
string

hasRequirements()

Method to check if model has requirements or validations

public hasRequirements() : bool
Return values
bool

parseFilter()

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
throws
Exception
Return values
int

replace()

Replace

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

update()

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>
Return values
bool|array<string|int, mixed>

        
On this page

Search results