PHP 클래스 Lazer\Classes\Core_Relation

저자: Grzegorz Kuźnik
파일 보기 프로젝트 열기: greg0/lazer-database

보호된 프로퍼티들

프로퍼티 타입 설명
$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