Skip to content

Latest commit

 

History

History
621 lines (302 loc) · 11.5 KB

class.CollectionCore.md

File metadata and controls

621 lines (302 loc) · 11.5 KB

Class CollectionCore

Create a collection of ObjectModel objects

Contents

Properties

Methods

Properties

$alias

protected mixed $alias = array()

$alias_iterator

protected mixed $alias_iterator

$classname

protected string $classname

$definition

protected array $definition = array()

$fields

protected mixed $fields = array()

$id_lang

protected integer $id_lang

$is_hydrated

protected boolean $is_hydrated = false

$iterator

protected integer $iterator

$query

protected \DbQuery $query

$results

protected array $results = array()

$total

protected integer $total

Methods

__construct

mixed CollectionCore::__construct(string $classname, integer $id_lang)

Arguments

  • $classname string
  • $id_lang integer

count

integer CollectionCore::count()

Get total of results

current

\ObjectModel CollectionCore::current()

Get current result

formatValue

mixed CollectionCore::formatValue(mixed $value, string $field)

Format a value with the type of the given field

Arguments

  • $value mixed
  • $field string - Field name

generateAlias

string CollectionCore::generateAlias(string $association)

Generate uniq alias from association name

Arguments

  • $association string - Use empty association for alias on current table

getAll

\Collection CollectionCore::getAll(boolean $display_query)

Launch sql query to create collection of objects

Arguments

  • $display_query boolean - If true, query will be displayed (for debug purpose)

getFieldInfo

array CollectionCore::getFieldInfo(string $field)

Obtain some informations on a field (alias, name, type, etc.)

Arguments

  • $field string - Field name

getResults

array CollectionCore::getResults()

Get results array

groupBy

\Collection CollectionCore::groupBy(string $field)

Add GROUP BY restriction on query

Arguments

  • $field string - Field name

key

integer CollectionCore::key()

Get current result index

next

mixed CollectionCore::next()

Go to next result

offsetExists

boolean CollectionCore::offsetExists($offset)

Check if a result exist

Arguments

  • $offset mixed

offsetGet

\ObjectModel CollectionCore::offsetGet($offset)

Get a result by offset

Arguments

  • $offset mixed

offsetSet

mixed CollectionCore::offsetSet($offset, $value)

Add an element in the collection

Arguments

  • $offset mixed
  • $value mixed

offsetUnset

mixed CollectionCore::offsetUnset($offset)

Delete an element from the collection

Arguments

  • $offset mixed

orderBy

\Collection CollectionCore::orderBy(string $field, string $order)

Add ORDER BY restriction on query

Arguments

  • $field string - Field name
  • $order string - asc|desc

parseField

string CollectionCore::parseField(string $field)

Replace a field with its SQL version (E.g. manufacturer.name with a2.name)

Arguments

  • $field string - Field name

parseFields

string CollectionCore::parseFields(string $str)

Parse all fields with {field} syntax in a string

Arguments

  • $str string

rewind

mixed CollectionCore::rewind()

This method is called when a foreach begin

sqlWhere

mixed CollectionCore::sqlWhere(string $sql)

Add WHERE restriction on query using real SQL syntax

Arguments

  • $sql string

valid

boolean CollectionCore::valid()

Check if there is a current result

where

\Collection CollectionCore::where(string $field, string $operator, mixed $value)

Add WHERE restriction on query

Arguments

  • $field string - Field name
  • $operator string - List of operators : =, !=, , =, like, notlike, regexp, notregexp
  • $value mixed