A melhor parceira de TI para o seu negócio English version

API Reference

Pacote: database

Abstract Class TRecord

Description

Base class for Active Records

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


        
                    
Variable Summary
 mixed $attributes
 mixed $data
 mixed $vdata
Method Summary
 static all () void
 static countObjects ([$criteria $criteria = NULL]) An
 static find ( $id) The
 static getIndexedArray ( $indexColumn,  $valueColumn, [ $criteria = NULL]) the
 static getObjects ([$criteria $criteria = NULL], [$callObjectLoad $callObjectLoad = TRUE]) An
 static orderBy ($order $order, [$direction $direction = 'asc']) the
 static orWhere ( $variable,  $operator,  $value) the
 static where ( $variable,  $operator,  $value, [ $logicOperator = TExpression::AND_OPERATOR]) the
 static __callStatic ($method $method, $parameter $parameters) void
 __construct ([[$id] $id = NULL], [ $callObjectLoad = TRUE]) TRecord
 addAttribute ( $attribute) void
 belongsToMany ($aggregate_class $aggregate_class, [$join_class $join_class = NULL], [$foreign_key_parent $foreign_key_parent = NULL], [$foreign_key_child $foreign_key_child = NULL], $id 4) Array
 delete ([[$id] $id = NULL]) void
 deleteComposite ($composite_class $composite_class, $foreign_key $foreign_key, $id $id) void
 exists ($id $id) void
 fromArray ($data $data) void
 getAttributes () void
 getCacheControl () void
 getEntity () A
 getFirstID () An
 getLastID () An
 hasMany ($composite_class $composite_class, [$foreign_key $foreign_key = NULL], [$local_id $local_id = NULL], [ $order = NULL]) Array
 load ($id $id) The
 loadAggregate ($aggregate_class $aggregate_class, $join_class $join_class, $foreign_key_parent $foreign_key_parent, $foreign_key_child $foreign_key_child, [$id $id = NULL]) Array
 loadComposite ($composite_class $composite_class, $foreign_key $foreign_key, [$id $id = NULL], [ $order = NULL]) Array
 mergeObject (TRecord $object) void
 reload () void
 save () void
 saveAggregate ($join_class $join_class, $foreign_key_parent $foreign_key_parent, $foreign_key_child $foreign_key_child, $id $id, $objects $objects) void
 saveComposite ($composite_class $composite_class, $foreign_key $foreign_key, $id $id, $objects $objects) void
 store () The
 toArray () An
 toJson () A
 __clone () void
 __get ($property $property) The
 __isset ($property $property) void
 __set ($property $property, $value $value) void
 __unset ($property $property) void
Variables
mixed $attributes (line 30)
  • access: protected
mixed $data (line 28)
  • access: protected
mixed $vdata (line 29)
  • access: protected
Methods
static all (line 1038)

Returns all objects

  • access: public
void all ()
static countObjects (line 856)

Method countObjects

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

Find a Active Record and returns it

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

Creates an indexed array

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

Method getObjects

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

Creates an ordered repository

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

Creates a Repository with OR filter

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

Creates a Repository with filter

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

Executed whenever an unknown method is executed

  • access: public
void __callStatic ($method $method, $parameter $parameters)
  • $method $method: Method name
  • $parameter $parameters: Method parameters
Constructor __construct (line 37)

Class Constructor

Instantiates the Active Record

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

Register an persisted attribute

  • access: public
void addAttribute ( $attribute)
  • $attribute
belongsToMany (line 990)

Load aggregated objects. Shortcut to loadAggregate

  • return: of Active Records
  • access: public
Array belongsToMany ($aggregate_class $aggregate_class, [$join_class $join_class = NULL], [$foreign_key_parent $foreign_key_parent = NULL], [$foreign_key_child $foreign_key_child = NULL], $id 4)
  • $id 4: Primary key of parent object
  • $aggregate_class $aggregate_class: Active Record Class for aggregated objects
  • $join_class $join_class: Active Record Join Class (Parent / Aggregated)
  • $foreign_key_parent $foreign_key_parent: Foreign key in Join Class to parent object
  • $foreign_key_child $foreign_key_child: Foreign key in Join Class to child object
delete (line 703)

Delete an Active Record object from the database

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

Delete composite objects (parts in composition relationship)

  • access: public
void deleteComposite ($composite_class $composite_class, $foreign_key $foreign_key, $id $id)
  • $composite_class $composite_class: Active Record Class for composite objects
  • $foreign_key $foreign_key: Foreign key in composite objects
  • $id $id: Primary key of parent object
exists (line 526)

Tests if an ID exists

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

Fill the Active Record properties from an indexed array

  • access: public
void fromArray ($data $data)
  • $data $data: An indexed array containing the object properties
getAttributes (line 371)

Return the persisted attributes

  • access: public
void getAttributes ()
getCacheControl (line 215)

Returns the cache control

  • access: public
void getCacheControl ()
getEntity (line 241)

Returns the name of database entity

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

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
An getFirstID ()
getLastID (line 805)

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
An getLastID ()
getPrimaryKey (line 253)

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

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

Load composite objects. Shortcut for loadComposite

  • return: of Active Records
  • access: public
Array hasMany ($composite_class $composite_class, [$foreign_key $foreign_key = NULL], [$local_id $local_id = NULL], [ $order = NULL])
  • $composite_class $composite_class: Active Record Class for composite objects
  • $foreign_key $foreign_key: Foreign key in composite objects
  • $local_id $local_id: Primary key of parent object
  • $order
load (line 593)

Load an Active Record Object from the database

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

Load aggregated objects (parts in aggregation relationship)

  • return: of Active Records
  • access: public
Array loadAggregate ($aggregate_class $aggregate_class, $join_class $join_class, $foreign_key_parent $foreign_key_parent, $foreign_key_child $foreign_key_child, [$id $id = NULL])
  • $aggregate_class $aggregate_class: Active Record Class for aggregated objects
  • $join_class $join_class: Active Record Join Class (Parent / Aggregated)
  • $foreign_key_parent $foreign_key_parent: Foreign key in Join Class to parent object
  • $foreign_key_child $foreign_key_child: Foreign key in Join Class to child object
  • $id $id: Primary key of parent object
loadComposite (line 878)

Load composite objects (parts in composition relationship)

  • return: of Active Records
  • access: public
Array loadComposite ($composite_class $composite_class, $foreign_key $foreign_key, [$id $id = NULL], [ $order = NULL])
  • $composite_class $composite_class: Active Record Class for composite objects
  • $foreign_key $foreign_key: Foreign key in composite objects
  • $id $id: Primary key of parent object
  • $order
mergeObject (line 284)

Fill the Active Record properties from another Active Record

  • access: public
void mergeObject (TRecord $object)
  • $object $object: An Active Record
reload (line 579)

ReLoad an Active Record Object from the database

  • access: public
void reload ()
save (line 1046)

Save the object

  • access: public
void save ()
saveAggregate (line 1008)

Save aggregated objects (parts in aggregation relationship)

  • access: public
void saveAggregate ($join_class $join_class, $foreign_key_parent $foreign_key_parent, $foreign_key_child $foreign_key_child, $id $id, $objects $objects)
  • $join_class $join_class: Active Record Join Class (Parent / Aggregated)
  • $foreign_key_parent $foreign_key_parent: Foreign key in Join Class to parent object
  • $foreign_key_child $foreign_key_child: Foreign key in Join Class to child object
  • $id $id: Primary key of parent object
  • $objects $objects: Array of Active Records to be saved
saveComposite (line 934)

Save composite objects (parts in composition relationship)

  • access: public
void saveComposite ($composite_class $composite_class, $foreign_key $foreign_key, $id $id, $objects $objects)
  • $composite_class $composite_class: Active Record Class for composite objects
  • $foreign_key $foreign_key: Foreign key in composite objects
  • $id $id: Primary key of parent object
  • $objects $objects: Array of Active Records to be saved
store (line 381)

Store the objects into the database

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

Return the Active Record properties as an indexed array

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

Return the Active Record properties as a json string

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

Executed when the programmer clones an Active Record

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

  • access: public
void __clone ()
__get (line 109)

Executed whenever a property is accessed

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

Returns if a property is assigned

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

Executed whenever a property is assigned

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

Unset a property

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