menu

Adianti Solutions

API

Adianti, Framework, PHP, MVC, Active record, Front controller, IDE, RAD, Web, multiplataforma, geração de código, desenvolvimento rápido, relatórios, formulários, listagens, datagrids, gráficos, banco de dados, padrões de projeto, design patterns API do Adianti Framework.
API Docs
code
Selecione a classe

Class TRecord

Description

Base class for Active Records

Located in /database/TRecord.php (line 27)


	
			
Variable Summary
mixed $attributes
mixed $data
mixed $vdata
Method Summary
static all ()
static countObjects ([$criteria = NULL])
static create ($data)
static find ($id)
static first ()
static getIndexedArray ($indexColumn, $valueColumn, [$criteria = NULL])
static getObjects ([$criteria = NULL], [$callObjectLoad = TRUE])
static last ()
static orderBy ($order, [$direction = 'asc'])
static orWhere ($variable, $operator, $value)
static select ()
static where ($variable, $operator, $value, [$logicOperator = TExpression::AND_OPERATOR])
static __callStatic ($method, $parameters)
__construct ([$id = NULL], [$callObjectLoad = TRUE])
addAttribute ($attribute)
belongsToMany ($aggregate_class, [$join_class = NULL], [$foreign_key_parent = NULL], [$foreign_key_child = NULL])
delete ([$id = NULL])
deleteComposite ($composite_class, $foreign_key, $id, [$callObjectLoad = FALSE])
evaluate ($pattern)
exists ($id)
filterMany ($composite_class, [$foreign_key = NULL], [$primary_key = NULL], [$order = NULL])
fromArray ($data)
hasMany ($composite_class, [$foreign_key = NULL], [$primary_key = NULL], [$order = NULL])
load ($id)
loadAggregate ($aggregate_class, $join_class, $foreign_key_parent, $foreign_key_child, [$id = NULL])
loadComposite ($composite_class, $foreign_key, [$id = NULL], [$order = NULL])
mergeObject ($object)
reload ()
render ($pattern, [$cast = null])
save ()
saveAggregate ($join_class, $foreign_key_parent, $foreign_key_child, $id, $objects)
saveComposite ($composite_class, $foreign_key, $id, $objects, [$callObjectLoad = FALSE])
store ()
toArray ()
toJson ()
__clone ()
__get ($property)
__isset ($property)
__set ($property, $value)
__unset ($property)
Variables
mixed $attributes (line 31)
  • access: protected
mixed $data (line 29)
  • access: protected
mixed $vdata (line 30)
  • access: protected
Methods
static all (line 1133)

Returns all objects

  • access: public
static all ()
static countObjects (line 926)

Method countObjects

  • return: array containing the Active Records
  • access: public
static countObjects ([$criteria = NULL])
  • $criteria: Optional criteria
static create (line 69)

Create a new TRecord and returns the instance

  • access: public
static create ($data)
  • $data: indexed array
static find (line 1123)

Find a Active Record and returns it

  • return: Active Record itself or NULL when not found
  • access: public
static find ($id)
  • $id
static first (line 1100)

Returns the first object

  • access: public
static first ()
static getIndexedArray (line 1150)

Creates an indexed array

  • return: TRepository object with a filter
  • access: public
static getIndexedArray ($indexColumn, $valueColumn, [$criteria = NULL])
  • $indexColumn
  • $valueColumn
  • $criteria
static getObjects (line 906)

Method getObjects

  • return: array containing the Active Records
  • access: public
static getObjects ([$criteria = NULL], [$callObjectLoad = TRUE])
  • $criteria: Optional criteria
  • $callObjectLoad: If load() method from Active Records must be called to load object parts
static last (line 1111)

Returns the last object

  • access: public
static last ()
static orderBy (line 1221)

Creates an ordered repository

  • return: ordered TRepository object
  • access: public
static orderBy ($order, [$direction = 'asc'])
  • $order: = Order column
  • $direction: = Order direction (asc, desc)
static orWhere (line 1208)

Creates a Repository with OR filter

  • return: TRepository object with an OR filter
  • access: public
static orWhere ($variable, $operator, $value)
  • $variable
  • $operator
  • $value
static select (line 1186)

Creates a Repository with filter

  • return: TRepository object with a filter
  • access: public
static select ()
static where (line 1197)

Creates a Repository with filter

  • return: TRepository object with a filter
  • access: public
static where ($variable, $operator, $value, [$logicOperator = TExpression::AND_OPERATOR])
  • $variable
  • $operator
  • $value
  • $logicOperator
static __callStatic (line 92)

Executed whenever an unknown method is executed

  • access: public
static __callStatic ($method, $parameters)
  • $method: Method name
  • $parameters: Method parameters
Constructor __construct (line 38)

Class Constructor

Instantiates the Active Record

  • access: public
__construct ([$id = NULL], [$callObjectLoad = TRUE])
  • $id: Optional Object ID, if passed, load this object
  • $callObjectLoad
addAttribute (line 417)

Register an persisted attribute

  • access: public
addAttribute ($attribute)
  • $attribute
belongsToMany (line 1063)

Load aggregated objects. Shortcut to loadAggregate

  • return: of Active Records
  • access: public
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 (line 773)

Delete an Active Record object from the database

  • exception: Exception if there's no active transaction opened
  • access: public
delete ([$id = NULL])
  • $id: The Object ID
deleteComposite (line 992)

Delete composite objects (parts in composition relationship)

  • access: public
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 (line 400)

Evaluate variables inside brackets

  • access: public
evaluate ($pattern)
  • $pattern
exists (line 600)

Tests if an ID exists

  • exception: Exception if there's no active transaction opened
  • access: public
exists ($id)
  • $id: The object ID
filterMany (line 978)

Create a criteria to load composite objects

  • return: instance
  • access: public
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
fromArray (line 310)

Fill the Active Record properties from an indexed array

  • access: public
fromArray ($data)
  • $data: An indexed array containing the object properties
getAttributeList (line 438)

Get attribute list

  • access: public
getAttributeList ()
getAttributes (line 430)

Return the persisted attributes

  • access: public
getAttributes ()
getCacheControl (line 228)

Returns the cache control

  • access: public
getCacheControl ()
getEntity (line 254)

Returns the name of database entity

  • return: String containing the name of the entity
  • access: protected
getEntity ()
getFirstID (line 845)

Returns the FIRST Object ID from database

  • return: Integer containing the FIRST Object ID from database
  • exception: Exception if there's no active transaction opened
  • access: public
getFirstID ()
getLastID (line 875)

Returns the LAST Object ID from database

  • return: Integer containing the LAST Object ID from database
  • exception: Exception if there's no active transaction opened
  • access: public
getLastID ()
getPrimaryKey (line 266)

Returns the the name of the primary key for that Active Record

  • return: String containing the primary key name
  • access: public
getPrimaryKey ()
hasMany (line 964)

Load composite objects. Shortcut for loadComposite

  • return: of Active Records
  • access: public
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 (line 667)

Load an Active Record Object from the database

  • return: Active Record Object
  • exception: Exception if there's no active transaction opened
  • access: public
load ($id)
  • $id: The object ID
loadAggregate (line 1031)

Load aggregated objects (parts in aggregation relationship)

  • return: of Active Records
  • access: public
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
loadComposite (line 948)

Load composite objects (parts in composition relationship)

  • return: of Active Records
  • access: public
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
mergeObject (line 297)

Fill the Active Record properties from another Active Record

  • access: public
mergeObject ($object)
  • $object: An Active Record
reload (line 653)

ReLoad an Active Record Object from the database

  • access: public
reload ()
render (line 373)

Render variables inside brackets

  • access: public
render ($pattern, [$cast = null])
  • $pattern
  • $cast
save (line 1141)

Save the object

  • access: public
save ()
saveAggregate (line 1081)

Save aggregated objects (parts in aggregation relationship)

  • access: public
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
saveComposite (line 1008)

Save composite objects (parts in composition relationship)

  • access: public
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 (line 455)

Store the objects into the database

  • return: number of affected rows
  • exception: Exception if there's no active transaction opened
  • access: public
store ()
toArray (line 337)

Return the Active Record properties as an indexed array

  • return: indexed array containing the object properties
  • access: public
toArray ()
toJson (line 365)

Return the Active Record properties as a json string

  • return: JSON String
  • access: public
toJson ()
__clone (line 81)

Executed when the programmer clones an Active Record

In this case, we have to clear the ID, to generate a new one

  • access: public
__clone ()
__get (line 122)

Executed whenever a property is accessed

  • return: value of the property
  • access: public
__get ($property)
  • $property: Name of the object property
__isset (line 208)

Returns if a property is assigned

  • access: public
__isset ($property)
  • $property: Name of the object property
__set (line 170)

Executed whenever a property is assigned

  • access: public
__set ($property, $value)
  • $property: Name of the object property
  • $value: Value of the property
__unset (line 219)

Unset a property

  • access: public
__unset ($property)
  • $property: Name of the object property