PHP Класс Lazer\Classes\Core_Relation

Автор: Grzegorz Kuźnik
Показать файл Открыть проект

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

Свойство Тип Описание
$keys Relation keys names
$relationType string Current relation type
$relations array All relations types
$tables Tables names

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

Метод Описание
belongsTo ( string $table ) : Core_Relation Set relation one2many to table
build ( array $array, string $part ) : array
foreignKey ( string $key ) : Core_Relation Set foreign key name
getJunction ( ) : boolean | string Getter of junction table name in many2many relation
getRelation ( ) : array Get relation information
hasAndBelongsToMany ( string $table ) : Core_Relation Set relation many2many to table
hasMany ( string $table ) : Core_Relation Set relation many2one to table
localKey ( string $key ) : Core_Relation Set local key name
relations ( ) : array Get relations types
removeRelation ( ) Remove relation
setRelation ( ) Set specified relation
table ( string $name ) : Lazer\Classes\Relation Factory method
with ( string $table ) : Core_Relation Use relation to table

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

Метод Описание
addRelation ( ) Add data to configs and create all necessary files
deleteRelationData ( string $from, string $to ) Inserts relation data to config file
insertRelationData ( string $from, string $to, string $type, array $keys ) Inserts relation data to config file
join ( object $row ) : Lazer\Classes\Database Process query with joined data
setKey ( string $type, string $key ) : Core_Relation Set key name
setRelationType ( string $relation ) Set relation type to field
setTable ( string $type, string $name ) Set table name

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

addRelation() защищенный метод

Add data to configs and create all necessary files
protected addRelation ( )

belongsTo() публичный метод

Set relation one2many to table
public belongsTo ( string $table ) : Core_Relation
$table string Table name
Результат Core_Relation

build() публичный метод

public build ( array $array, string $part ) : array
$array array
$part string
Результат array

deleteRelationData() защищенный метод

Inserts relation data to config file
protected deleteRelationData ( string $from, string $to )
$from string Local table
$to string Related table

foreignKey() публичный метод

Set foreign key name
public foreignKey ( string $key ) : Core_Relation
$key string key name
Результат Core_Relation

getJunction() публичный метод

Getter of junction table name in many2many relation
public getJunction ( ) : boolean | string
Результат boolean | string Name of junction table or false

getRelation() публичный метод

Get relation information
public getRelation ( ) : array
Результат array relation information

hasAndBelongsToMany() публичный метод

Set relation many2many to table
public hasAndBelongsToMany ( string $table ) : Core_Relation
$table string Table name
Результат Core_Relation

hasMany() публичный метод

Set relation many2one to table
public hasMany ( string $table ) : Core_Relation
$table string Table name
Результат Core_Relation

insertRelationData() защищенный метод

Inserts relation data to config file
protected insertRelationData ( string $from, string $to, string $type, array $keys )
$from string Local table
$to string Related table
$type string Relation type
$keys array Relationed keys

join() защищенный метод

Process query with joined data
protected join ( object $row ) : Lazer\Classes\Database
$row object One row of data
Результат Lazer\Classes\Database

localKey() публичный метод

Set local key name
public localKey ( string $key ) : Core_Relation
$key string key name
Результат Core_Relation

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

Get relations types
public static relations ( ) : array
Результат array

removeRelation() публичный метод

Remove relation
public removeRelation ( )

setKey() защищенный метод

Set key name
protected setKey ( string $type, string $key ) : Core_Relation
$type string local or foreign
$key string key name
Результат Core_Relation

setRelation() публичный метод

Set specified relation
public setRelation ( )

setRelationType() защищенный метод

Set relation type to field
protected setRelationType ( string $relation )
$relation string Name of relation

setTable() защищенный метод

Set table name
protected setTable ( string $type, string $name )
$type string local or foreign
$name string table name

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

Factory method
public static table ( string $name ) : Lazer\Classes\Relation
$name string Name of table
Результат Lazer\Classes\Relation

with() публичный метод

Use relation to table
public with ( string $table ) : Core_Relation
$table string Table name
Результат Core_Relation

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

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

Relation keys names
protected $keys

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

Current relation type
protected string $relationType
Результат string

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

All relations types
protected static array $relations
Результат array

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

Tables names
protected $tables