PHP 클래스 CakeSchema

상속: extends Object
파일 보기 프로젝트 열기: baserproject/basercms 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$connection string Connection used for read.
$file string File to write.
$name string Name of the schema.
$path string Path to write location.
$plugin string Plugin name.
$tables array Set of tables.

공개 메소드들

메소드 설명
__construct ( array $options = [] ) Constructor
after ( array $event = [] ) : void After callback to be implemented in subclasses.
before ( array $event = [] ) : boolean Before callback to be implemented in subclasses.
build ( array $data ) : void Builds schema object properties.
compare ( array | object $old, array | object $new = null ) : array Compares two sets of schemas.
generateTable ( string $table, array $fields ) : string Generate the schema code for a table.
load ( array $options = [] ) : array Reads database and creates schema tables.
read ( array $options = [] ) : array Reads database and creates schema tables.
write ( array | object $object, array $options = [] ) : mixed Writes schema file from object or options.

보호된 메소드들

메소드 설명
_arrayDiffAssoc ( array $array1, array $array2 ) : array Extended array_diff_assoc noticing change from/to NULL values.
_columns ( &$Obj ) : array Formats Schema columns from Model Object.
_compareIndexes ( array $new, array $old ) : mixed Compare two schema indexes.
_compareTableParameters ( array $new, array $old ) : mixed Compare two schema files table Parameters.
_noPrefixTable ( string $prefix, string $table ) : string Trim the table prefix from the full table name, and return the prefix-less table.
_requireFile ( string $path, string $file ) : boolean Attempts to require the schema file specified.
_values ( array $values ) : array Formats Schema columns from Model Object.

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( array $options = [] )
$options array Optional load object properties.

_arrayDiffAssoc() 보호된 메소드

It behaves almost the same way as array_diff_assoc except for NULL values: if one of the values is not NULL - change is detected. It is useful in situation where one value is strval('') ant other is strval(null) - in string comparing methods this results as EQUAL, while it is not.
protected _arrayDiffAssoc ( array $array1, array $array2 ) : array
$array1 array Base array.
$array2 array Corresponding array checked for equality.
리턴 array Difference as array with array(keys => values) from input array where match was not found.

_columns() 보호된 메소드

Formats Schema columns from Model Object.
protected _columns ( &$Obj ) : array
리턴 array Formatted columns.

_compareIndexes() 보호된 메소드

Compare two schema indexes.
protected _compareIndexes ( array $new, array $old ) : mixed
$new array New indexes.
$old array Old indexes.
리턴 mixed False on failure or array of indexes to add and drop.

_compareTableParameters() 보호된 메소드

Compare two schema files table Parameters.
protected _compareTableParameters ( array $new, array $old ) : mixed
$new array New indexes.
$old array Old indexes.
리턴 mixed False on failure, or an array of parameters to add & drop.

_noPrefixTable() 보호된 메소드

Trim the table prefix from the full table name, and return the prefix-less table.
protected _noPrefixTable ( string $prefix, string $table ) : string
$prefix string Table prefix.
$table string Full table name.
리턴 string Prefix-less table name.

_requireFile() 보호된 메소드

Attempts to require the schema file specified.
protected _requireFile ( string $path, string $file ) : boolean
$path string Filesystem path to the file.
$file string Filesystem basename of the file.
리턴 boolean True when a file was successfully included, false on failure.

_values() 보호된 메소드

Formats Schema columns from Model Object.
protected _values ( array $values ) : array
$values array Options keys(type, null, default, key, length, extra).
리턴 array Formatted values.

after() 공개 메소드

After callback to be implemented in subclasses.
public after ( array $event = [] ) : void
$event array Schema object properties.
리턴 void

before() 공개 메소드

Before callback to be implemented in subclasses.
public before ( array $event = [] ) : boolean
$event array Schema object properties.
리턴 boolean Should process continue.

build() 공개 메소드

Builds schema object properties.
public build ( array $data ) : void
$data array Loaded object properties.
리턴 void

compare() 공개 메소드

Compares two sets of schemas.
public compare ( array | object $old, array | object $new = null ) : array
$old array | object Schema object or array.
$new array | object Schema object or array.
리턴 array Tables (that are added, dropped, or changed.)

generateTable() 공개 메소드

Takes a table name and $fields array and returns a completed, escaped variable declaration to be used in schema classes.
public generateTable ( string $table, array $fields ) : string
$table string Table name you want returned.
$fields array Array of field information to generate the table with.
리턴 string Variable declaration for a schema class.

load() 공개 메소드

Reads database and creates schema tables.
public load ( array $options = [] ) : array
$options array Schema object properties.
리턴 array Set of name and tables.

read() 공개 메소드

Options - 'connection' - the db connection to use - 'name' - name of the schema - 'models' - a list of models to use, or false to ignore models
public read ( array $options = [] ) : array
$options array Schema object properties.
리턴 array Array indexed by name and tables.

write() 공개 메소드

Writes schema file from object or options.
public write ( array | object $object, array $options = [] ) : mixed
$object array | object Schema object or options array.
$options array Schema object properties to override object.
리턴 mixed False or string written to file.

프로퍼티 상세

$connection 공개적으로 프로퍼티

Connection used for read.
public string $connection
리턴 string

$file 공개적으로 프로퍼티

File to write.
public string $file
리턴 string

$name 공개적으로 프로퍼티

Name of the schema.
public string $name
리턴 string

$path 공개적으로 프로퍼티

Path to write location.
public string $path
리턴 string

$plugin 공개적으로 프로퍼티

Plugin name.
public string $plugin
리턴 string

$tables 공개적으로 프로퍼티

Set of tables.
public array $tables
리턴 array