PHP 클래스 lazyrecord\schema\DeclareSchema

상속: extends SchemaBase, implements LazyRecord\Schema\SchemaInterface
파일 보기 프로젝트 열기: corneltek/lazyrecord 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$collectionInterfaceClasses string[]
$collectionTraitClasses string[]
$enableColumnAccessors
$indexes
$modelInterfaceClasses string[]
$modelTraitClasses string[]
$onDelete
$onUpdate

공개 메소드들

메소드 설명
__construct ( array $options = [] ) Constructor of declare schema.
__toString ( )
addCollectionInterface ( $iface ) Implement interface in collection class.
addCollectionTrait ( $traitClass ) : ClassTemplate\ClassTrait Use trait for the model class.
addColumn ( DeclareColumn $column ) : DeclareColumn Add column object into the column list.
addModelInterface ( $iface ) Implement interface in model class.
addModelTrait ( $traitClass ) : ClassTemplate\ClassTrait Use trait for the model class.
addSeed ( string $seed ) Add seed class.
belongsTo ( $accessor, string $foreignClass, string $foreignColumn = 'id', string $selfColumn = null ) define self primary key to foreign key reference.
column ( string $name, string $class = 'LazyRecord\Schema\DeclareColumn' ) : DeclareColumn Define new column object.
dump ( )
export ( )
findPrimaryKey ( ) : string Find primary key from columns.
findPrimaryKeyColumn ( ) : DeclareColumn Find primary key column object from columns.
getClassFileName ( )
getClassName ( )
getCollectionInterfaces ( ) : string[]
getCollectionTraitClasses ( ) : string[]
getColumn ( string $name ) 'getColumn' gets the column object by the given column name.
getColumnLabels ( $includeVirtual = false )
getColumnNames ( boolean $includeVirtual = false ) : string[]
getColumns ( $includeVirtual = false )
getDirectory ( ) : string Get directory from current schema object.
getIndexQueries ( ) : SQLBuilder\Universal\Query\CreateIndexQuery[]
getLabel ( )
getModelClass ( ) : string Get model class name of this schema.
getModelInterfaces ( ) : string[]
getModelTraitClasses ( ) : string[]
getModificationTime ( ) : integer Return the modification time of this schema definition class.
getMsgIds ( )
getPrimaryKey ( ) : string Get the primary key column name.
getReadSourceId ( )
getRelatedClassPath ( string $class ) : string Get the related class file path by the given class name.
getShortClassName ( )
getTable ( ) : string Get the table name of this schema class.
getWriteSourceId ( )
hasColumn ( string $name ) : boolean hasColumn method returns true if a column name is defined.
hasMany ( )
hasOne ( string $accessor, string $foreignClass, string $foreignColumn = null, string $selfColumn ) has-one relationship.
insertColumn ( DeclareColumn $column ) Insert column object at the begining of the column list.
isNewerThanFile ( string $path ) : boolean isNewerThanFile returns true if the schema file is newer than a file.
label ( string $label ) Define schema label.
many ( string $accessor, string $foreignClass, string $foreignColumn, string $selfColumn ) Add has-many relation.
manyToMany ( string $accessor, string $relationId, string $foreignRelationId )
mixin ( string $class, array $options = [] ) Mixin.
onDelete ( string $action ) onDelete defines a software trigger of delete action.
onUpdate ( $action ) onUpdate defines a software trigger of update action.
readFrom ( string $id ) set data source for read.
removeColumn ( $columnName )
requireProxyFileUpdate ( ) : boolean requireProxyFileUpdate returns true if the schema proxy file is out of date.
schema ( )
seeds ( ) : DeclareSchema 'seeds' helps you define seed classes.
table ( string $table ) Define table name.
using ( string $id ) set data source for both write and read.
writeTo ( string $id ) set data source for write.

보호된 메소드들

메소드 설명
_classnameToTable ( ) : string Convert current model name to a class name.
_modelClassToLabel ( )
build ( array $options = [] ) Build schema build the schema by running the "schema" method.
disableColumnAccessors ( ) SchemaGenerator generates column accessor methods from the column definition automatically.
getCurrentSchemaClass ( )
helper ( string $helperName, array $arguments = [] ) : BaseHelper Invode helper.
index ( $name, $columns = null, $using = null ) : SQLBuilder\Universal\Query\CreateIndexQuery 'index' method helps you define index queries.
insertAutoIdPrimaryColumn ( string $name = 'id', string $columnType = 'integer' ) Insert a primary key column with auto increment.
resolveSchemaClass ( $class )

메소드 상세

__construct() 공개 메소드

The constructor calls build method to build the schema information.
public __construct ( array $options = [] )
$options array

__toString() 공개 메소드

public __toString ( )

_classnameToTable() 보호된 메소드

Convert current model name to a class name.
protected _classnameToTable ( ) : string
리턴 string table name

_modelClassToLabel() 보호된 메소드

protected _modelClassToLabel ( )

addCollectionInterface() 공개 메소드

Implement interface in collection class.
public addCollectionInterface ( $iface )

addCollectionTrait() 공개 메소드

Use trait for the model class.
public addCollectionTrait ( $traitClass ) : ClassTemplate\ClassTrait
리턴 ClassTemplate\ClassTrait object

addColumn() 공개 메소드

Add column object into the column list.
public addColumn ( DeclareColumn $column ) : DeclareColumn
$column DeclareColumn
리턴 DeclareColumn

addModelInterface() 공개 메소드

Implement interface in model class.
public addModelInterface ( $iface )

addModelTrait() 공개 메소드

Use trait for the model class.
public addModelTrait ( $traitClass ) : ClassTemplate\ClassTrait
리턴 ClassTemplate\ClassTrait object

addSeed() 공개 메소드

Add seed class.
public addSeed ( string $seed )
$seed string

belongsTo() 공개 메소드

comments( post_id => author.comment_id ) $post->publisher
public belongsTo ( $accessor, string $foreignClass, string $foreignColumn = 'id', string $selfColumn = null )
$foreignClass string foreign schema class.
$foreignColumn string foreign reference schema column.
$selfColumn string self column name

build() 보호된 메소드

The post process find the primary key from the built columns And insert the auto-increment primary is auto_id config is enabled.
protected build ( array $options = [] )
$options array

column() 공개 메소드

Define new column object.
public column ( string $name, string $class = 'LazyRecord\Schema\DeclareColumn' ) : DeclareColumn
$name string column name
$class string column class name
리턴 DeclareColumn

disableColumnAccessors() 보호된 메소드

If you don't want these accessors to be generated, you may simply call 'disableColumnAccessors'
protected disableColumnAccessors ( )

dump() 공개 메소드

public dump ( )

export() 공개 메소드

public export ( )

findPrimaryKey() 공개 메소드

This method will be called after building schema information to save the primary key name
public findPrimaryKey ( ) : string
리턴 string primary key

findPrimaryKeyColumn() 공개 메소드

This method will be called after building schema information to save the primary key name
public findPrimaryKeyColumn ( ) : DeclareColumn
리턴 DeclareColumn

getClassFileName() 공개 메소드

public getClassFileName ( )

getClassName() 공개 메소드

public getClassName ( )

getCollectionInterfaces() 공개 메소드

public getCollectionInterfaces ( ) : string[]
리턴 string[]

getCollectionTraitClasses() 공개 메소드

public getCollectionTraitClasses ( ) : string[]
리턴 string[]

getColumn() 공개 메소드

'getColumn' gets the column object by the given column name.
public getColumn ( string $name )
$name string

getColumnLabels() 공개 메소드

public getColumnLabels ( $includeVirtual = false )

getColumnNames() 공개 메소드

public getColumnNames ( boolean $includeVirtual = false ) : string[]
$includeVirtual boolean
리턴 string[]

getColumns() 공개 메소드

public getColumns ( $includeVirtual = false )

getCurrentSchemaClass() 보호된 메소드

protected getCurrentSchemaClass ( )

getDirectory() 공개 메소드

Get directory from current schema object.
public getDirectory ( ) : string
리턴 string path

getIndexQueries() 공개 메소드

public getIndexQueries ( ) : SQLBuilder\Universal\Query\CreateIndexQuery[]
리턴 SQLBuilder\Universal\Query\CreateIndexQuery[]

getLabel() 공개 메소드

public getLabel ( )

getModelClass() 공개 메소드

Get model class name of this schema.
public getModelClass ( ) : string
리턴 string model class name

getModelInterfaces() 공개 메소드

public getModelInterfaces ( ) : string[]
리턴 string[]

getModelTraitClasses() 공개 메소드

public getModelTraitClasses ( ) : string[]
리턴 string[]

getModificationTime() 공개 메소드

Return the modification time of this schema definition class.
public getModificationTime ( ) : integer
리턴 integer timestamp

getMsgIds() 공개 메소드

public getMsgIds ( )

getPrimaryKey() 공개 메소드

Get the primary key column name.
public getPrimaryKey ( ) : string
리턴 string primary key column name

getReadSourceId() 공개 메소드

public getReadSourceId ( )

getRelatedClassPath() 공개 메소드

Get the related class file path by the given class name.
public getRelatedClassPath ( string $class ) : string
$class string the scheam related class name
리턴 string the class filepath.

getShortClassName() 공개 메소드

public getShortClassName ( )

getTable() 공개 메소드

Get the table name of this schema class.
public getTable ( ) : string
리턴 string

getWriteSourceId() 공개 메소드

public getWriteSourceId ( )

hasColumn() 공개 메소드

hasColumn method returns true if a column name is defined.
public hasColumn ( string $name ) : boolean
$name string
리턴 boolean

hasMany() 공개 메소드

public hasMany ( )

hasOne() 공개 메소드

model( post_id => post )
public hasOne ( string $accessor, string $foreignClass, string $foreignColumn = null, string $selfColumn )
$accessor string accessor name.
$foreignClass string foreign schema class
$foreignColumn string foreign schema column
$selfColumn string self schema column

helper() 보호된 메소드

Invode helper.
protected helper ( string $helperName, array $arguments = [] ) : BaseHelper
$helperName string
$arguments array indexed array, passed to the init function of helper class.
리턴 LazyRecord\Schema\Helper\BaseHelper

index() 보호된 메소드

'index' method helps you define index queries.
protected index ( $name, $columns = null, $using = null ) : SQLBuilder\Universal\Query\CreateIndexQuery
리턴 SQLBuilder\Universal\Query\CreateIndexQuery

insertAutoIdPrimaryColumn() 보호된 메소드

Insert a primary key column with auto increment.
protected insertAutoIdPrimaryColumn ( string $name = 'id', string $columnType = 'integer' )
$name string default to 'id'
$columnType string 'int', 'smallint', 'bigint' ...

insertColumn() 공개 메소드

Insert column object at the begining of the column list.
public insertColumn ( DeclareColumn $column )
$column DeclareColumn

isNewerThanFile() 공개 메소드

isNewerThanFile returns true if the schema file is newer than a file.
public isNewerThanFile ( string $path ) : boolean
$path string
리턴 boolean

label() 공개 메소드

Define schema label.
public label ( string $label )
$label string label name

many() 공개 메소드

TODO: provide a relationship object to handle sush operation, that will be: $this->hasMany('books','id') ->from('App_Model_Book','author_id')
public many ( string $accessor, string $foreignClass, string $foreignColumn, string $selfColumn )
$accessor string accessor name.
$foreignClass string foreign schema class
$foreignColumn string foreign schema column
$selfColumn string self schema column

manyToMany() 공개 메소드

public manyToMany ( string $accessor, string $relationId, string $foreignRelationId )
$accessor string accessor name.
$relationId string a hasMany relationship.
$foreignRelationId string foreign relation id.

mixin() 공개 메소드

Availabel mixins $this->mixin('Metadata' , array( options ) ); $this->mixin('I18n');
public mixin ( string $class, array $options = [] )
$class string mixin class name
$options array

onDelete() 공개 메소드

onDelete defines a software trigger of delete action.
public onDelete ( string $action )
$action string Currently for 'cascade'

onUpdate() 공개 메소드

onUpdate defines a software trigger of update action.
public onUpdate ( $action )

readFrom() 공개 메소드

set data source for read.
public readFrom ( string $id )
$id string data source id

removeColumn() 공개 메소드

public removeColumn ( $columnName )

requireProxyFileUpdate() 공개 메소드

requireProxyFileUpdate returns true if the schema proxy file is out of date.
public requireProxyFileUpdate ( ) : boolean
리턴 boolean

resolveSchemaClass() 보호된 메소드

protected resolveSchemaClass ( $class )

schema() 공개 메소드

public schema ( )

seeds() 공개 메소드

$this->seeds('User\\Seed','Data\\Seed');
public seeds ( ) : DeclareSchema
리턴 DeclareSchema

table() 공개 메소드

Define table name.
public table ( string $table )
$table string table name

using() 공개 메소드

set data source for both write and read.
public using ( string $id )
$id string data source id

writeTo() 공개 메소드

set data source for write.
public writeTo ( string $id )
$id string data source id

프로퍼티 상세

$collectionInterfaceClasses 공개적으로 프로퍼티

public string[] $collectionInterfaceClasses
리턴 string[]

$collectionTraitClasses 공개적으로 프로퍼티

public string[] $collectionTraitClasses
리턴 string[]

$enableColumnAccessors 공개적으로 프로퍼티

public $enableColumnAccessors

$indexes 공개적으로 프로퍼티

public $indexes

$modelInterfaceClasses 공개적으로 프로퍼티

public string[] $modelInterfaceClasses
리턴 string[]

$modelTraitClasses 공개적으로 프로퍼티

public string[] $modelTraitClasses
리턴 string[]

$onDelete 공개적으로 프로퍼티

public $onDelete

$onUpdate 공개적으로 프로퍼티

public $onUpdate