Basicis - Core

Logo

As the name says, it is made to be basic and direct.

View the Project on GitHub basicis/core

Basicis\Model\Model

Model class

Implements:

Basicis\Model\ModelInterface, Stringable

Methods

Name Description
__construct Function function
__toArray Function __toArray
Get Entity Data as Array, without the propreties defined in the array property $protecteds  
__toString Function __toString
Get Entity Data as Json, without the propreties defined in the array property $protecteds  
all Function all
Find all entities  
allToArray Function all
Find all entities, and return a array or null  
delete Function delete
Remove data of this entity of database  
exists Function exists
Check if a entity by any column match  
find Function find
Find a entity by id  
findBy Function findBy
Find all entities by any column match  
findOneBy Function findOneBy
Find a entity by any column match  
getCreated Function getCreated
Return entity created timestamp  
getId Function getId
Return entity ID (unique on system identification)  
getManager Function getManager
Get a instance of Doctrine ORM EntityManager an return this, or null  
getPropertyAnnotation Function getPropertyAnnotation
Get a array with property annotations data by prop and tag names, default tag Column  
getProtecteds Function getProtecteds
Get protecteds properties  
getTableName Function getTableName
Get entity table name  
getUpdated Function getUpdated
Return entity updated timestamp  
paginate Function paginate
Paginate entity search with start offset (0) and total, this is ten (10) by default  
query Function query
Execute a sql query string  
removeProtecteds Function removeProtecteds
Get Entity Data as Array, without the propreties defined in the array property $protecteds  
save Function save
Save data of this entity to database, use for create or update entities  
setCreated Function setCreated
Set entity creation timestamp  
setUpdated Function setUpdated
Set entity updated timestamp  

Model::__construct

Description

public __construct (array|int|null $data)

Function function

Parameters

Return Values

void


Model::__toArray

Description

public __toArray (void)

Function __toArray Get Entity Data as Array, without the propreties defined in the array property $protecteds

Parameters

This function has no parameters.

Return Values

array


Model::__toString

Description

public __toString (void)

Function __toString Get Entity Data as Json, without the propreties defined in the array property $protecteds

Parameters

This function has no parameters.

Return Values

string


Model::all

Description

public static all (void)

Function all Find all entities

Parameters

This function has no parameters.

Return Values

array


Model::allToArray

Description

public static allToArray (void)

Function all Find all entities, and return a array or null

Parameters

This function has no parameters.

Return Values

array|null


Model::delete

Description

public delete (void)

Function delete Remove data of this entity of database

Parameters

This function has no parameters.

Return Values

bool


Model::exists

Description

public static exists (array $findBy)

Function exists Check if a entity by any column match

Parameters

Return Values

bool


Model::find

Description

public static find (array $id)

Function find Find a entity by id

Parameters

Return Values

\Model|null


Model::findBy

Description

public static findBy (array $findBy)

Function findBy Find all entities by any column match

Parameters

Return Values

array|\Model[]|null


Model::findOneBy

Description

public static findOneBy (array $findOneBy)

Function findOneBy Find a entity by any column match

Parameters

Return Values

\Model|null


Model::getCreated

Description

public getCreated (void)

Function getCreated Return entity created timestamp

Parameters

This function has no parameters.

Return Values

\DateTime


Model::getId

Description

public getId (void)

Function getId Return entity ID (unique on system identification)

Parameters

This function has no parameters.

Return Values

int|null


Model::getManager

Description

public static getManager (string $class)

Function getManager Get a instance of Doctrine ORM EntityManager an return this, or null

Parameters

Return Values

\EntityManager|null


Model::getPropertyAnnotation

Description

public static getPropertyAnnotation (string $name, string $tag)

Function getPropertyAnnotation Get a array with property annotations data by prop and tag names, default tag Column

Parameters

Return Values

array|null


Model::getProtecteds

Description

public getProtecteds (void)

Function getProtecteds Get protecteds properties

Parameters

This function has no parameters.

Return Values

array


Model::getTableName

Description

public static getTableName (void)

Function getTableName Get entity table name

Parameters

This function has no parameters.

Return Values

string


Model::getUpdated

Description

public getUpdated (void)

Function getUpdated Return entity updated timestamp

Parameters

This function has no parameters.

Return Values

\DateTime


Model::paginate

Description

public static paginate (int $limit, int $offset, array $protecteds)

Function paginate Paginate entity search with start offset (0) and total, this is ten (10) by default

Parameters

Return Values

array


Model::query

Description

public static query (string $sql, array $protecteds)

Function query Execute a sql query string

Parameters

Return Values

array|null


Model::removeProtecteds

Description

public static removeProtecteds (void)

Function removeProtecteds Get Entity Data as Array, without the propreties defined in the array property $protecteds

Parameters

This function has no parameters.

Return Values

array


Model::save

Description

public save (void)

Function save Save data of this entity to database, use for create or update entities

Parameters

This function has no parameters.

Return Values

\Model


Model::setCreated

Description

public setCreated (string $created)

Function setCreated Set entity creation timestamp

Parameters

Return Values

\Model


Model::setUpdated

Description

public setUpdated (string $updated)

Function setUpdated Set entity updated timestamp

Parameters

Return Values

\User