Lançado Adianti Framework 7.6!
Clique aqui para saber mais
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

Implements interfaces:

  • IteratorAggregate (internal interface)

Base class for Active Records

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


	
			
Variable Summary
mixed $attributes
mixed $data
mixed $trashed
mixed $vdata
Method Summary
static all ([$indexed = false], [$withTrashed = FALSE])
static countObjects ([$criteria = NULL], [$withTrashed = FALSE])
static create ($data)
static find ($id, [$withTrashed = FALSE])
static first ([$withTrashed = FALSE])
static firstOrCreate ([$filters = NULL])
static firstOrNew ([$filters = NULL])
static getDeletedAtColumn ()
static getIndexedArray ($indexColumn, $valueColumn, [$criteria = NULL], [$withTrashed = FALSE])
static getObjects ([$criteria = NULL], [$callObjectLoad = TRUE], [$withTrashed = FALSE])
static groupBy ($group)
static last ([$withTrashed = FALSE])
static orderBy ($order, [$direction = 'asc'])
static orWhere ($variable, $operator, $value)
static select ()
static skip ($offset)
static take ($limit)
static where ($variable, $operator, $value, [$logicOperator = TExpression::AND_OPERATOR])
static withTrashed ()
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])
loadTrashed ($id)
mergeObject ($object)
reload ()
render ($pattern, [$cast = null])
restore ()
save ()
saveAggregate ($join_class, $foreign_key_parent, $foreign_key_child, $id, $objects)
saveComposite ($composite_class, $foreign_key, $id, $objects, [$callObjectLoad = FALSE])
store ()
toArray ([$filter_attributes = null])
toJson ()
__clone ()
__get ($property)
__isset ($property)
__set ($property, $value)
__unset ($property)
Variables
mixed $attributes (line 34)
  • access: protected
mixed $data (line 32)
  • access: protected
mixed $trashed (line 35)
  • access: protected
mixed $vdata (line 33)
  • access: protected
Methods
static all (line 1407)

Returns all objects

  • access: public
static all ([$indexed = false], [$withTrashed = FALSE])
  • $indexed
  • $withTrashed
static countObjects (line 1155)

Method countObjects

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

Create a new TRecord and returns the instance

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

Find a Active Record and returns it

  • return: Active Record itself or NULL when not found
  • access: public
static find ($id, [$withTrashed = FALSE])
  • $id
  • $withTrashed
static first (line 1332)

Returns the first object

  • access: public
static first ([$withTrashed = FALSE])
  • $withTrashed
static firstOrCreate (line 1367)

First record or persist a new one

  • access: public
static firstOrCreate ([$filters = NULL])
  • $filters
static firstOrNew (line 1343)

First record or a new one

  • access: public
static firstOrNew ([$filters = NULL])
  • $filters
static getDeletedAtColumn (line 329)

Returns the the name of the deleted at column

  • return: String containing the deleted at column
  • access: public
static getDeletedAtColumn ()
static getIndexedArray (line 1438)

Creates an indexed array

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

Method getObjects

  • return: array containing the Active Records
  • access: public
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
static groupBy (line 1484)

Creates a Repository with group

  • return: TRepository object with a group
  • access: public
static groupBy ($group)
  • $group
static last (line 1377)

Returns the last object

  • access: public
static last ([$withTrashed = FALSE])
  • $withTrashed
static orderBy (line 1516)

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 1504)

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 1474)

Creates a Repository with filter

  • return: TRepository object with a filter
  • access: public
static select ()
static skip (line 1536)

Creates a Repository with offset

  • return: TRepository object
  • access: public
static skip ($offset)
  • $offset
static take (line 1526)

Creates a Repository with limit

  • return: TRepository object
  • access: public
static take ($limit)
  • $limit
static where (line 1494)

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 withTrashed (line 1542)
  • access: public
static withTrashed ()
static __callStatic (line 105)

Executed whenever an unknown method is executed

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

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 515)

Register an persisted attribute

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

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 959)

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 1224)

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 486)

Evaluate variables inside brackets

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

Tests if an ID exists

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

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 385)

Fill the Active Record properties from an indexed array

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

Get attribute list

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

Return the persisted attributes

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

Returns the cache control

  • access: public
getCacheControl ()
getCreatedAtColumn (line 297)

Returns the the name of the created at column

  • return: String containing the created at column
  • access: public
getCreatedAtColumn ()
getEntity (line 273)

Returns the name of database entity

  • return: String containing the name of the entity
  • access: public
getEntity ()
getFirstID (line 1072)

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 ()
getIterator (line 73)

Returns iterator

  • access: public
getIterator ()

Implementation of:
IteratorAggregate::getIterator
getLastID (line 1102)

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 285)

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

  • return: String containing the primary key name
  • access: public
getPrimaryKey ()
getUpdatedAtColumn (line 313)

Returns the the name of the updated at column

  • return: String containing the updated at column
  • access: public
getUpdatedAtColumn ()
getVirtualData (line 442)

Return virtual data (non-persistant properties)

  • access: public
getVirtualData ()
hasMany (line 1193)

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 837)

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 1263)

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 1177)

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
loadTrashed (line 948)

Load trashed records

  • access: public
loadTrashed ($id)
  • $id
mergeObject (line 372)

Fill the Active Record properties from another Active Record

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

ReLoad an Active Record Object from the database

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

Render variables inside brackets

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

Restore soft deleted object

  • access: public
restore ()
save (line 1429)

Save the object

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

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 1240)

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 553)

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 413)

Return the Active Record properties as an indexed array

  • return: indexed array containing the object properties
  • access: public
toArray ([$filter_attributes = null])
  • $filter_attributes: Array of attributes to be returned.
toJson (line 451)

Return the Active Record properties as a json string

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

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 141)

Executed whenever a property is accessed

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

Returns if a property is assigned

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

Executed whenever a property is assigned

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

Unset a property

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