Axiom (v1.2.0)

A lightweight PHP framework
axModel Interface Reference

Interface for all model entities. More...

+ Inheritance diagram for axModel:

Public Member Functions

 __construct (PDO $pdo, $id=null)
 Constructor.
 create (array $data)
 Create a record.
 retrieve ($id)
 Fetches data from a record according to its id.
 update (array $data=array())
 Update a record, optionaly added with the $data parameter.
 delete ()
 Delete a record.
 getTable ()
 Get the record's original table name.
 getColumns ()
 Get the record's original table columns.
 getData ()
 Get the record's native data.

Static Public Member Functions

static all (PDO $pdo, array $search_params=array(), array $options=array())
 Get a list of records, optionaly filtered by $search_params and $options parameters.

Detailed Description

Interface for all model entities.

A model entity consist in a single row, extracted from an RDBMS table.

Warning:
You MUST implement this interface if you want your classes to be generated throught the axDatabase factory.
Author:
Delespierre
Since:
1.2.0
License:
http://www.gnu.org/licenses/lgpl.html Lesser General Public Licence version 3

Definition at line 21 of file axModel.class.php.


Constructor & Destructor Documentation

axModel::__construct ( PDO $  pdo,
id = null 
)

Constructor.

Parameters:
PDO$pdoThe database connection instance
mixed$id[optional] [default null] The ID of the row to match

Implemented in axMySQLObject, and axBaseModel.


Member Function Documentation

static axModel::all ( PDO $  pdo,
array $  search_params = array(),
array $  options = array() 
) [static]

Get a list of records, optionaly filtered by $search_params and $options parameters.

Returns the list as an instance of axPDOStatementIterator in case of success, false on failure.

Parameters:
PDO$pdo
array$search_params[optional] [default array()] The filtering parameters
array$options[optional] [default array()] The options parameters
Returns:
axPDOStatementIterator

Implemented in axMySQLObject.

axModel::create ( array $  data)

Create a record.

Returns the current record in case of success (instance of axModel) or false on failure.

Parameters:
array$dataThe data to be recorded
Returns:
axModel

Implemented in axBaseModel.

Delete a record.

Returns the deletion status.

Returns:
boolean

Implemented in axBaseModel.

Get the record's original table columns.

Returns:
array

Implemented in axMySQLObject.

Get the record's native data.

Returns:
array

Implemented in axBaseModel.

Get the record's original table name.

Returns:
string

Implemented in axMySQLObject.

axModel::retrieve ( id)

Fetches data from a record according to its id.

Returns the current record in case of success (instance of axModel) or false on failure.

Parameters:
mixed$idThe ID of the record
Returns:
axModel

Implemented in axBaseModel.

axModel::update ( array $  data = array())

Update a record, optionaly added with the $data parameter.

Returns the current record in case of success (instance of axModel) or false on failure.

Parameters:
array$data[optional] [default array()] The data to add to the record
Returns:
axModel

Implemented in axBaseModel.


The documentation for this interface was generated from the following file:
 All Data Structures Files Functions Variables