PHP Класс Contao\Model\Registry

The class handles traversing a set of models and lazy loads the database result rows upon their first usage.
Автор: Tristan Lins ([email protected])
Наследование: implements Countable
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$arrAliases array Aliases to PK's by table and column
$arrIdentities array Models by object hash
$arrRegistry array Models by table and PK
$objInstance static Object instance (Singleton)

Открытые методы

Метод Описание
__clone ( ) Prevent cloning of the object (Singleton)
count ( ) : integer Count the elements
fetch ( string $strTable, mixed $varKey, string $strAlias = null ) : Model | null Fetch a model by table name and primary key
fetchByAlias ( string $strTable, string $strAlias, mixed $varValue ) : Model | null Fetch a model by one of its aliases
getInstance ( ) : static Return the current object instance (Singleton)
isRegistered ( Model $objModel ) : boolean Check if a model is registered
isRegisteredAlias ( Model $objModel, string $strAlias, mixed $varValue ) : boolean Check if an alias is registered
register ( Model $objModel ) Register a model in the registry
registerAlias ( Model $objModel, string $strAlias, mixed $varValue ) Register an alias for a model
unregister ( Model $objModel ) Unregister a model from the registry
unregisterAlias ( Model $objModel, string $strAlias, mixed $varValue ) Unregister an alias

Защищенные методы

Метод Описание
__construct ( ) Prevent direct instantiation (Singleton)

Описание методов

__clone() закрытый публичный Метод

Prevent cloning of the object (Singleton)
final public __clone ( )

__construct() защищенный Метод

Prevent direct instantiation (Singleton)
protected __construct ( )

count() публичный Метод

Count the elements
public count ( ) : integer
Результат integer The number of models

fetch() публичный Метод

Fetch a model by table name and primary key
public fetch ( string $strTable, mixed $varKey, string $strAlias = null ) : Model | null
$strTable string The table name
$varKey mixed The key
$strAlias string An optional alias
Результат Contao\Model | null The model or null

fetchByAlias() публичный Метод

Fetch a model by one of its aliases
public fetchByAlias ( string $strTable, string $strAlias, mixed $varValue ) : Model | null
$strTable string The table name
$strAlias string The alias
$varValue mixed The alias value
Результат Contao\Model | null The model or null

getInstance() публичный статический Метод

Return the current object instance (Singleton)
public static getInstance ( ) : static
Результат static The object instance

isRegistered() публичный Метод

Check if a model is registered
public isRegistered ( Model $objModel ) : boolean
$objModel Contao\Model The model object
Результат boolean True if the model is registered

isRegisteredAlias() публичный Метод

Check if an alias is registered
public isRegisteredAlias ( Model $objModel, string $strAlias, mixed $varValue ) : boolean
$objModel Contao\Model The model object
$strAlias string The alias name
$varValue mixed The value of the alias
Результат boolean True if the alias is registered

register() публичный Метод

Register a model in the registry
public register ( Model $objModel )
$objModel Contao\Model The model object

registerAlias() публичный Метод

Register an alias for a model
public registerAlias ( Model $objModel, string $strAlias, mixed $varValue )
$objModel Contao\Model The model object
$strAlias string The alias name
$varValue mixed The value of the alias

unregister() публичный Метод

Unregister a model from the registry
public unregister ( Model $objModel )
$objModel Contao\Model The model object

unregisterAlias() публичный Метод

Unregister an alias
public unregisterAlias ( Model $objModel, string $strAlias, mixed $varValue )
$objModel Contao\Model The model object
$strAlias string The alias name
$varValue mixed The value of the alias

Описание свойств

$arrAliases защищенное свойство

Aliases to PK's by table and column
protected array $arrAliases
Результат array

$arrIdentities защищенное свойство

Models by object hash
protected array $arrIdentities
Результат array

$arrRegistry защищенное свойство

Models by table and PK
protected array $arrRegistry
Результат array

$objInstance защищенное статическое свойство

Object instance (Singleton)
protected static static $objInstance
Результат static