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 TRepository

Description

Implements the Repository Pattern to deal with collections of Active Records

Located in /database/TRepository.php (line 24)


	
			
Variable Summary
mixed $aggregates
mixed $class
mixed $columns
mixed $criteria
mixed $setValues
mixed $trashed
Method Summary
__construct ($class, [$withTrashed = FALSE])
aggregate ($function, $column, [$alias = null])
avgBy ($column, [$alias = null])
avgByAnd ($column, [$alias = null])
count ([$criteria = NULL])
countBy ($column, [$alias = null])
countByAnd ($column, [$alias = null])
countDistinctBy ($column, [$alias = null])
delete ([$criteria = NULL], [$callObjectLoad = FALSE])
dump ([$prepared = FALSE])
filter (Callable$callback, [$callObjectLoad = TRUE])
first ([$callObjectLoad = TRUE])
get ([$criteria = NULL], [$callObjectLoad = TRUE])
getIndexedArray ($indexColumn, [$valueColumn = NULL], [$criteria = NULL])
groupBy ($group)
last ([$callObjectLoad = TRUE])
load ([$criteria = NULL], [$callObjectLoad = TRUE])
maxBy ($column, [$alias = null])
maxByAnd ($column, [$alias = null])
minBy ($column, [$alias = null])
minByAnd ($column, [$alias = null])
orderBy ($order, [$direction = 'asc'])
orWhere ($variable, $operator, $value)
select ($columns)
set ($column, $value)
setCriteria ($criteria)
skip ($offset)
sumBy ($column, [$alias = null])
sumByAnd ($column, [$alias = null])
take ($limit)
transform (Callable$callback, [$callObjectLoad = TRUE])
update ([$setValues = NULL], [$criteria = NULL])
where ($variable, $operator, $value, [$logicOperator = TExpression::AND_OPERATOR])
Variables
mixed $aggregates (line 31)
  • access: protected
mixed $class (line 26)
  • access: protected
mixed $columns (line 30)
  • access: protected
mixed $criteria (line 28)
  • access: protected
mixed $setValues (line 29)
  • access: protected
mixed $trashed (line 27)
  • access: protected
Methods
Constructor __construct (line 37)

Class Constructor

  • access: public
__construct ($class, [$withTrashed = FALSE])
  • $class: = Active Record class name
  • $withTrashed
aggregate (line 761)

Aggregate column

  • return: array of objects or the total value (if does not have group by)
  • access: protected
aggregate ($function, $column, [$alias = null])
  • $function: Aggregate function (count, sum, min, max, avg)
  • $column
  • $alias
avgBy (line 693)

Average aggregate

  • return: array of objects or the total value (if does not have group by)
  • access: public
avgBy ($column, [$alias = null])
  • $column: Column to be aggregated
  • $alias: Column alias
avgByAnd (line 704)

Average aggregate and do another aggregate after

  • return: object
  • access: public
avgByAnd ($column, [$alias = null])
  • $column: Column to be aggregated
  • $alias: Column alias
count (line 578)

Return the amount of objects that satisfy a given criteria

  • return: Integer containing the amount of objects that satisfy the criteria
  • access: public
count ([$criteria = NULL])
  • $criteria: An TCriteria object, specifiyng the filters
countBy (line 647)

Count aggregate

  • return: array of objects or the total value (if does not have group by)
  • access: public
countBy ($column, [$alias = null])
  • $column: Column to be aggregated
  • $alias: Column alias
countByAnd (line 658)

Count aggregate and do another aggregate after

  • return: object
  • access: public
countByAnd ($column, [$alias = null])
  • $column: Column to be aggregated
  • $alias: Column alias
countDistinctBy (line 635)

Count distinct aggregate

  • return: array of objects or the total value (if does not have group by)
  • access: public
countDistinctBy ($column, [$alias = null])
  • $column: Column to be aggregated
  • $alias
delete (line 454)

Delete a collection of Active Records from database

  • return: affected rows
  • access: public
delete ([$criteria = NULL], [$callObjectLoad = FALSE])
  • $criteria: An TCriteria object, specifiyng the filters
  • $callObjectLoad
dump (line 915)

Dump Criteria

  • access: public
dump ([$prepared = FALSE])
  • $prepared
filter (line 893)

Returns filtered collection

  • access: public
filter (Callable$callback, [$callObjectLoad = TRUE])
  • Callable$callback
  • $callObjectLoad
first (line 848)

Returns the first collection item

  • access: public
first ([$callObjectLoad = TRUE])
  • $callObjectLoad
get (line 840)

Alias for load()

  • access: public
get ([$criteria = NULL], [$callObjectLoad = TRUE])
  • $criteria
  • $callObjectLoad
getAttributeList (line 89)

Get attribute list from entity

  • access: protected
getAttributeList ()
getEntity (line 81)

Returns the name of database entity

  • return: String containing the name of the entity
  • access: protected
getEntity ()
getIndexedArray (line 318)

Return a indexed array

  • access: public
getIndexedArray ($indexColumn, [$valueColumn = NULL], [$criteria = NULL])
  • $indexColumn
  • $valueColumn
  • $criteria
groupBy (line 180)

Define the group for criteria using fluent interfaces

  • return: TRepository object
  • access: public
groupBy ($group)
  • $group: Group column
last (line 860)

Returns the last collection item

  • access: public
last ([$callObjectLoad = TRUE])
  • $callObjectLoad
load (line 219)

Load a collection of objects from database using a criteria

  • return: array containing the Active Records
  • access: public
load ([$criteria = NULL], [$callObjectLoad = TRUE])
  • $criteria: An TCriteria object, specifiyng the filters
  • $callObjectLoad: If load() method from Active Records must be called to load object parts
loadStatic (line 310)

Load with no aggregates

  • access: public
loadStatic ()
maxBy (line 739)

Max aggregate

  • return: array of objects or the total value (if does not have group by)
  • access: public
maxBy ($column, [$alias = null])
  • $column: Column to be aggregated
  • $alias: Column alias
maxByAnd (line 750)

Max aggregate and do another aggregate after

  • return: object
  • access: public
maxByAnd ($column, [$alias = null])
  • $column: Column to be aggregated
  • $alias: Column alias
minBy (line 716)

Min aggregate

  • return: array of objects or the total value (if does not have group by)
  • access: public
minBy ($column, [$alias = null])
  • $column: Column to be aggregated
  • $alias: Column alias
minByAnd (line 727)

Min aggregate and do another aggregate after

  • return: object
  • access: public
minByAnd ($column, [$alias = null])
  • $column: Column to be aggregated
  • $alias: Column alias
orderBy (line 166)

Define the ordering for criteria using fluent interfaces

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

Add a run time OR criteria using fluent interfaces

  • return: TRepository object
  • access: public
orWhere ($variable, $operator, $value)
  • $variable: = variable
  • $operator: = comparison operator (>,<,=)
  • $value: = value to be compared
select (line 105)

Define columns list

  • access: public
select ($columns)
  • $columns
set (line 134)

Assign values to the database columns

  • return: TRepository object
  • access: public
set ($column, $value)
  • $column: = column name
  • $value: = column value
setCriteria (line 63)

Set criteria

  • access: public
setCriteria ($criteria)
  • $criteria
skip (line 206)

Define the OFFSET criteria using fluent interfaces

  • return: TRepository object
  • access: public
skip ($offset)
  • $offset: = Offset
sumBy (line 670)

Sum aggregate

  • return: array of objects or the total value (if does not have group by)
  • access: public
sumBy ($column, [$alias = null])
  • $column: Column to be aggregated
  • $alias: Column alias
sumByAnd (line 681)

Sum aggregate and do another aggregate after

  • return: object
  • access: public
sumByAnd ($column, [$alias = null])
  • $column: Column to be aggregated
  • $alias: Column alias
take (line 193)

Define the LIMIT criteria using fluent interfaces

  • return: TRepository object
  • access: public
take ($limit)
  • $limit: = Limit
transform (line 875)

Returns transformed collection

  • access: public
transform (Callable$callback, [$callObjectLoad = TRUE])
  • Callable$callback
  • $callObjectLoad
update (line 350)

Update values in the repository

  • access: public
update ([$setValues = NULL], [$criteria = NULL])
  • $setValues
  • $criteria
where (line 120)

Add a run time criteria using fluent interfaces

  • return: TRepository object
  • access: public
where ($variable, $operator, $value, [$logicOperator = TExpression::AND_OPERATOR])
  • $variable: = variable
  • $operator: = comparison operator (>,<,=)
  • $value: = value to be compared
  • $logicOperator: = logical operator (TExpression::AND_OPERATOR, TExpression::OR_OPERATOR)
withTrashed (line 71)

Set withTrashed using fluent interfaces

  • access: public
withTrashed ()