PHP 클래스 Contao\Model\Collection

The class handles traversing a set of models and lazy loads the database result rows upon their first usage.
상속: implements ArrayAccess, implements Countable, implements IteratorAggregate
파일 보기 프로젝트 열기: contao/core-bundle 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$arrModels Contao\Model[] Models
$intIndex integer Current index
$strTable string Table name

공개 메소드들

메소드 설명
__construct ( array $arrModels, string $strTable ) Create a new collection
__get ( string $strKey ) : mixed | null Return an object property
__isset ( string $strKey ) : boolean Check whether a property is set
__set ( string $strKey, mixed $varValue ) Set an object property
count ( ) : integer Return the number of rows in the result set
createFromDbResult ( Result $objResult, string $strTable ) : static Create a new collection from a database result
current ( ) : Model Return the current model
delete ( ) : integer Delete the current model and return the number of affected rows
fetchAll ( ) : array Fetch all columns of every row
fetchEach ( string $strKey ) : array Fetch a column of each row
first ( ) : static Go to the first row
getIterator ( ) : ArrayIterator Retrieve the iterator object
getModels ( ) : Model[] Return the models as array
getRelated ( string $strKey ) : Model | static Lazy load related records
last ( ) : static Go to the last row
next ( ) : static | boolean Go to the next row
offsetExists ( integer $offset ) : boolean Check whether an offset exists
offsetGet ( integer $offset ) : Model | null Retrieve a particular offset
offsetSet ( integer $offset, mixed $value ) Set a particular offset
offsetUnset ( integer $offset ) Unset a particular offset
prev ( ) : static | false Go to the previous row
reset ( ) : static Reset the model
row ( ) : array Return the current row as associative array
save ( ) : static Save the current model
setRow ( array $arrData ) : static Set the current row from an array

메소드 상세

__construct() 공개 메소드

Create a new collection
public __construct ( array $arrModels, string $strTable )
$arrModels array An array of models
$strTable string The table name

__get() 공개 메소드

Return an object property
public __get ( string $strKey ) : mixed | null
$strKey string The property name
리턴 mixed | null The property value or null

__isset() 공개 메소드

Check whether a property is set
public __isset ( string $strKey ) : boolean
$strKey string The property name
리턴 boolean True if the property is set

__set() 공개 메소드

Set an object property
public __set ( string $strKey, mixed $varValue )
$strKey string The property name
$varValue mixed The property value

count() 공개 메소드

Return the number of rows in the result set
public count ( ) : integer
리턴 integer The number of rows

createFromDbResult() 공개 정적인 메소드

Create a new collection from a database result
public static createFromDbResult ( Result $objResult, string $strTable ) : static
$objResult Contao\Database\Result The database result object
$strTable string The table name
리턴 static The model collection

current() 공개 메소드

Return the current model
public current ( ) : Model
리턴 Contao\Model The model object

delete() 공개 메소드

Delete the current model and return the number of affected rows
public delete ( ) : integer
리턴 integer The number of affected rows

fetchAll() 공개 메소드

Fetch all columns of every row
public fetchAll ( ) : array
리턴 array An array with all rows and columns

fetchEach() 공개 메소드

Fetch a column of each row
public fetchEach ( string $strKey ) : array
$strKey string The property name
리턴 array An array with all property values

first() 공개 메소드

Go to the first row
public first ( ) : static
리턴 static The model collection object

getIterator() 공개 메소드

Retrieve the iterator object
public getIterator ( ) : ArrayIterator
리턴 ArrayIterator The iterator object

getModels() 공개 메소드

Return the models as array
public getModels ( ) : Model[]
리턴 Contao\Model[] An array of models

getRelated() 공개 메소드

Lazy load related records
public getRelated ( string $strKey ) : Model | static
$strKey string The property name
리턴 Contao\Model | static The model or a model collection if there are multiple rows

last() 공개 메소드

Go to the last row
public last ( ) : static
리턴 static The model collection object

next() 공개 메소드

Go to the next row
public next ( ) : static | boolean
리턴 static | boolean The model collection object or false if there is no next row

offsetExists() 공개 메소드

Check whether an offset exists
public offsetExists ( integer $offset ) : boolean
$offset integer The offset
리턴 boolean True if the offset exists

offsetGet() 공개 메소드

Retrieve a particular offset
public offsetGet ( integer $offset ) : Model | null
$offset integer The offset
리턴 Contao\Model | null The model or null

offsetSet() 공개 메소드

Set a particular offset
public offsetSet ( integer $offset, mixed $value )
$offset integer The offset
$value mixed The value to set

offsetUnset() 공개 메소드

Unset a particular offset
public offsetUnset ( integer $offset )
$offset integer The offset

prev() 공개 메소드

Go to the previous row
public prev ( ) : static | false
리턴 static | false The model collection object or false if there is no previous row

reset() 공개 메소드

Reset the model
public reset ( ) : static
리턴 static The model collection object

row() 공개 메소드

Return the current row as associative array
public row ( ) : array
리턴 array The current row as array

save() 공개 메소드

Save the current model
public save ( ) : static
리턴 static The model collection object

setRow() 공개 메소드

Set the current row from an array
public setRow ( array $arrData ) : static
$arrData array The row data as array
리턴 static The model collection object

프로퍼티 상세

$arrModels 보호되어 있는 프로퍼티

Models
protected Model[],Contao $arrModels
리턴 Contao\Model[]

$intIndex 보호되어 있는 프로퍼티

Current index
protected int $intIndex
리턴 integer

$strTable 보호되어 있는 프로퍼티

Table name
protected string $strTable
리턴 string