Returns all objects
static
all
([$indexed = false], [$withTrashed = FALSE])
Method countObjects
static
countObjects
([$criteria = NULL], [$withTrashed = FALSE])
-
$criteria: Optional criteria
-
$withTrashed
Create a new TRecord and returns the instance
static
create
($data)
Find a Active Record and returns it
static
find
($id, [$withTrashed = FALSE])
Returns the first object
static
first
([$withTrashed = FALSE])
First record or persist a new one
static
firstOrCreate
([$filters = NULL])
First record or a new one
static
firstOrNew
([$filters = NULL])
Returns the the name of the deleted at column
static
getDeletedAtColumn
()
Creates an indexed array
static
getIndexedArray
($indexColumn, $valueColumn, [$criteria = NULL], [$withTrashed = FALSE])
-
$indexColumn
-
$valueColumn
-
$criteria
-
$withTrashed
Method getObjects
static
getObjects
([$criteria = NULL], [$callObjectLoad = TRUE], [$withTrashed = FALSE])
-
$criteria: Optional criteria
-
$callObjectLoad: If load() method from Active Records must be called to load object parts
-
$withTrashed
Creates a Repository with group
static
groupBy
($group)
Returns the last object
static
last
([$withTrashed = FALSE])
Creates an ordered repository
static
orderBy
($order, [$direction = 'asc'])
-
$order: = Order column
-
$direction: = Order direction (asc, desc)
Creates a Repository with OR filter
static
orWhere
($variable, $operator, $value)
-
$variable
-
$operator
-
$value
Creates a Repository with filter
static
select
()
Creates a Repository with offset
static
skip
($offset)
Creates a Repository with limit
static
take
($limit)
Creates a Repository with filter
static
where
($variable, $operator, $value, [$logicOperator = TExpression::AND_OPERATOR])
-
$variable
-
$operator
-
$value
-
$logicOperator
Executed whenever an unknown method is executed
static
__callStatic
($method, $parameters)
-
$method: Method name
-
$parameters: Method parameters
Class Constructor
Instantiates the Active Record
__construct
([$id = NULL], [$callObjectLoad = TRUE])
-
$id: Optional Object ID, if passed, load this object
-
$callObjectLoad
Register an persisted attribute
addAttribute
($attribute)
Load aggregated objects. Shortcut to loadAggregate
belongsToMany
($aggregate_class, [$join_class = NULL], [$foreign_key_parent = NULL], [$foreign_key_child = NULL])
-
$aggregate_class: Active Record Class for aggregated objects
-
$join_class: Active Record Join Class (Parent / Aggregated)
-
$foreign_key_parent: Foreign key in Join Class to parent object
-
$foreign_key_child: Foreign key in Join Class to child object
Delete an Active Record object from the database
delete
([$id = NULL])
Delete composite objects (parts in composition relationship)
deleteComposite
($composite_class, $foreign_key, $id, [$callObjectLoad = FALSE])
-
$composite_class: Active Record Class for composite objects
-
$foreign_key: Foreign key in composite objects
-
$id: Primary key of parent object
-
$callObjectLoad
Evaluate variables inside brackets
evaluate
($pattern)
Tests if an ID exists
exists
($id)
Create a criteria to load composite objects
filterMany
($composite_class, [$foreign_key = NULL], [$primary_key = NULL], [$order = NULL])
-
$composite_class: Active Record Class for composite objects
-
$foreign_key: Foreign key in composite objects
-
$primary_key: Primary key of parent object
-
$order
Fill the Active Record properties from an indexed array
fromArray
($data)
-
$data: An indexed array containing the object properties
Get attribute list
getAttributeList
()
Return the persisted attributes
getAttributes
()
Returns the cache control
getCacheControl
()
Returns the the name of the created at column
getCreatedAtColumn
()
Returns the name of database entity
getEntity
()
Returns the FIRST Object ID from database
getFirstID
()
Returns iterator
getIterator
()
Implementation of:
- IteratorAggregate::getIterator
Returns the LAST Object ID from database
getLastID
()
Returns the the name of the primary key for that Active Record
getPrimaryKey
()
Returns the the name of the updated at column
getUpdatedAtColumn
()
Return virtual data (non-persistant properties)
getVirtualData
()
Load composite objects. Shortcut for loadComposite
hasMany
($composite_class, [$foreign_key = NULL], [$primary_key = NULL], [$order = NULL])
-
$composite_class: Active Record Class for composite objects
-
$foreign_key: Foreign key in composite objects
-
$primary_key: Primary key of parent object
-
$order
Load an Active Record Object from the database
load
($id)
Load aggregated objects (parts in aggregation relationship)
loadAggregate
($aggregate_class, $join_class, $foreign_key_parent, $foreign_key_child, [$id = NULL])
-
$aggregate_class: Active Record Class for aggregated objects
-
$join_class: Active Record Join Class (Parent / Aggregated)
-
$foreign_key_parent: Foreign key in Join Class to parent object
-
$foreign_key_child: Foreign key in Join Class to child object
-
$id: Primary key of parent object
Load composite objects (parts in composition relationship)
loadComposite
($composite_class, $foreign_key, [$id = NULL], [$order = NULL])
-
$composite_class: Active Record Class for composite objects
-
$foreign_key: Foreign key in composite objects
-
$id: Primary key of parent object
-
$order
Load trashed records
loadTrashed
($id)
Fill the Active Record properties from another Active Record
mergeObject
($object)
-
$object: An Active Record
ReLoad an Active Record Object from the database
reload
()
Render variables inside brackets
render
($pattern, [$cast = null])
Restore soft deleted object
restore
()
Save aggregated objects (parts in aggregation relationship)
saveAggregate
($join_class, $foreign_key_parent, $foreign_key_child, $id, $objects)
-
$join_class: Active Record Join Class (Parent / Aggregated)
-
$foreign_key_parent: Foreign key in Join Class to parent object
-
$foreign_key_child: Foreign key in Join Class to child object
-
$id: Primary key of parent object
-
$objects: Array of Active Records to be saved
Save composite objects (parts in composition relationship)
saveComposite
($composite_class, $foreign_key, $id, $objects, [$callObjectLoad = FALSE])
-
$composite_class: Active Record Class for composite objects
-
$foreign_key: Foreign key in composite objects
-
$id: Primary key of parent object
-
$objects: Array of Active Records to be saved
-
$callObjectLoad
Store the objects into the database
store
()
Return the Active Record properties as an indexed array
toArray
([$filter_attributes = null])
-
$filter_attributes: Array of attributes to be returned.
Return the Active Record properties as a json string
toJson
()
Executed when the programmer clones an Active Record
In this case, we have to clear the ID, to generate a new one
__clone
()
Executed whenever a property is accessed
__get
($property)
-
$property: Name of the object property
Returns if a property is assigned
__isset
($property)
-
$property: Name of the object property
Executed whenever a property is assigned
__set
($property, $value)
-
$property: Name of the object property
-
$value: Value of the property
Unset a property
__unset
($property)
-
$property: Name of the object property