PHP Class ORMWrapper, paris

You shouldn't need to interact with this class directly. It is used internally by the Model base class.
Inheritance: extends ORM
Show file Open project: j4mie/paris Class Usage Examples

Protected Properties

Property Type Description
$_class_name string The wrapped find_one and find_many classes will return an instance or instances of this class.

Public Methods

Method Description
create ( $data = null ) : ORMWrapper | boolean Wrap Idiorm's create method to return an empty instance of the class associated with this wrapper instead of the raw ORM class.
filter ( ) : ORMWrapper Add a custom filter to the method chain specified on the model class. This allows custom queries to be added to models. The filter should take an instance of the ORM wrapper as its first argument and return an instance of the ORM wrapper. Any arguments passed to this method after the name of the filter will be passed to the called filter function as arguments after the ORM class.
find_many ( ) : Array Wrap Idiorm's find_many method to return an array of instances of the class associated with this wrapper instead of the raw ORM class.
find_one ( null | integer $id = null ) : Model Wrap Idiorm's find_one method to return an instance of the class associated with this wrapper instead of the raw ORM class.
for_table ( string $table_name, string $connection_name = parent::DEFAULT_CONNECTION ) : ORMWrapper Factory method, return an instance of this class bound to the supplied table name.
set_class_name ( string $class_name ) : void Set the name of the class which the wrapped methods should return instances of.

Protected Methods

Method Description
_create_model_instance ( ORM $orm ) : boolean | Model Method to create an instance of the model class associated with this wrapper and populate it with the supplied Idiorm instance.

Method Details

_create_model_instance() protected method

Method to create an instance of the model class associated with this wrapper and populate it with the supplied Idiorm instance.
protected _create_model_instance ( ORM $orm ) : boolean | Model
$orm ORM
return boolean | Model

create() public method

Wrap Idiorm's create method to return an empty instance of the class associated with this wrapper instead of the raw ORM class.
public create ( $data = null ) : ORMWrapper | boolean
return ORMWrapper | boolean

filter() public method

Add a custom filter to the method chain specified on the model class. This allows custom queries to be added to models. The filter should take an instance of the ORM wrapper as its first argument and return an instance of the ORM wrapper. Any arguments passed to this method after the name of the filter will be passed to the called filter function as arguments after the ORM class.
public filter ( ) : ORMWrapper
return ORMWrapper

find_many() public method

Wrap Idiorm's find_many method to return an array of instances of the class associated with this wrapper instead of the raw ORM class.
public find_many ( ) : Array
return Array

find_one() public method

Wrap Idiorm's find_one method to return an instance of the class associated with this wrapper instead of the raw ORM class.
public find_one ( null | integer $id = null ) : Model
$id null | integer
return Model

for_table() public static method

A repeat of content in parent::for_table, so that created class is ORMWrapper, not ORM
public static for_table ( string $table_name, string $connection_name = parent::DEFAULT_CONNECTION ) : ORMWrapper
$table_name string
$connection_name string
return ORMWrapper

set_class_name() public method

Set the name of the class which the wrapped methods should return instances of.
public set_class_name ( string $class_name ) : void
$class_name string
return void

Property Details

$_class_name protected property

The wrapped find_one and find_many classes will return an instance or instances of this class.
protected string $_class_name
return string