PHP 클래스 Tools\Model\Table\Table

상속: extends Shim\Model\Table\Table
파일 보기 프로젝트 열기: dereuromark/cakephp-tools 1 사용 예제들

공개 메소드들

메소드 설명
getFieldInUse ( string $groupField, string $type = 'all', array $options = [] ) : Query Get all fields that have been used so far
getNextAutoIncrement ( ) : integer | boolean Return the next auto increment id from the current table UUIDs will return false
getRelatedInUse ( string $tableName, string | null $groupField = null, string $type = 'all', array $options = [] ) : Query Get all related entries that have been used so far
truncate ( ) : void truncate()
validateAll ( array $entities ) : boolean
validateDate ( mixed $value, array $options = [], array $context = [] ) : boolean Validation of Date fields (as the core one is buggy!!!)
validateDateRange ( mixed $value, array $options = [], array $context = [] ) : boolean Validation of Date Fields (>= minDate && <= maxDate)
validateDateTime ( mixed $value, array $options = [], array $context = [] ) : boolean Validation of DateTime Fields (both Date and Time together)
validateIdentical ( mixed $value, array | string $options = [], array $context = [] ) : boolean Checks if the content of 2 fields are equal Does not check on empty fields! Return TRUE even if both are empty (secure against empty in another rule)!
validateTime ( mixed $value, array $options = [], array $context = [] ) : boolean Validation of Time fields
validateTimeRange ( mixed $value, array $options = [], array $context = [] ) : boolean Validation of Time Fields (>= minTime && <= maxTime)
validateUniqueExt ( mixed $value, array $options, array $context = [] ) : boolean Validator method used to check the uniqueness of a value for a column.
validateUrl ( array | string $url, array $options = [], array $context = [] ) : boolean Checks if a URL is valid AND accessible (returns false otherwise)

보호된 메소드들

메소드 설명
_autoCompleteUrl ( string $url ) : string Prepend protocol if missing
_validUrl ( string $url ) : boolean Checks if a url is valid

메소드 상세

_autoCompleteUrl() 보호된 메소드

Prepend protocol if missing
protected _autoCompleteUrl ( string $url ) : string
$url string
리턴 string URL

_validUrl() 보호된 메소드

Checks if a url is valid
protected _validUrl ( string $url ) : boolean
$url string
리턴 boolean Success

getFieldInUse() 공개 메소드

Get all fields that have been used so far
public getFieldInUse ( string $groupField, string $type = 'all', array $options = [] ) : Query
$groupField string Field to group by
$type string Find type
$options array
리턴 Cake\ORM\Query

getNextAutoIncrement() 공개 메소드

Return the next auto increment id from the current table UUIDs will return false
public getNextAutoIncrement ( ) : integer | boolean
리턴 integer | boolean next auto increment value or False on failure

getRelatedInUse() 공개 메소드

Get all related entries that have been used so far
public getRelatedInUse ( string $tableName, string | null $groupField = null, string $type = 'all', array $options = [] ) : Query
$tableName string The related model
$groupField string | null Field to group by
$type string Find type
$options array
리턴 Cake\ORM\Query

truncate() 공개 메소드

truncate()
public truncate ( ) : void
리턴 void

validateAll() 공개 메소드

public validateAll ( array $entities ) : boolean
$entities array
리턴 boolean

validateDate() 공개 메소드

Validation of Date fields (as the core one is buggy!!!)
public validateDate ( mixed $value, array $options = [], array $context = [] ) : boolean
$value mixed
$options array - dateFormat (defaults to 'ymd') - allowEmpty - after/before (fieldName to validate against) - min (defaults to 0 - equal is OK too)
$context array
리턴 boolean Success

validateDateRange() 공개 메소드

Validation of Date Fields (>= minDate && <= maxDate)
public validateDateRange ( mixed $value, array $options = [], array $context = [] ) : boolean
$value mixed
$options array - min/max (TODO!!)
$context array
리턴 boolean

validateDateTime() 공개 메소드

Validation of DateTime Fields (both Date and Time together)
public validateDateTime ( mixed $value, array $options = [], array $context = [] ) : boolean
$value mixed
$options array - dateFormat (defaults to 'ymd') - allowEmpty - after/before (fieldName to validate against) - min/max (defaults to >= 1 - at least 1 minute apart)
$context array
리턴 boolean Success

validateIdentical() 공개 메소드

Options: - compare: field to compare to - cast: if casting should be applied to both values
public validateIdentical ( mixed $value, array | string $options = [], array $context = [] ) : boolean
$value mixed
$options array | string
$context array
리턴 boolean Success

validateTime() 공개 메소드

Validation of Time fields
public validateTime ( mixed $value, array $options = [], array $context = [] ) : boolean
$value mixed
$options array - timeFormat (defaults to 'hms') - allowEmpty - after/before (fieldName to validate against) - min/max (defaults to >= 1 - at least 1 minute apart)
$context array
리턴 boolean Success

validateTimeRange() 공개 메소드

Validation of Time Fields (>= minTime && <= maxTime)
public validateTimeRange ( mixed $value, array $options = [], array $context = [] ) : boolean
$value mixed
$options array - min/max (TODO!!)
$context array
리턴 boolean

validateUniqueExt() 공개 메소드

This is meant to be used with the validation API and not to be called directly. ### Example: {{{ $validator->add('email', [ 'unique' => ['rule' => 'validateUnique', 'provider' => 'table'] ]) }}} Unique validation can be scoped to the value of another column: {{{ $validator->add('email', [ 'unique' => [ 'rule' => ['validateUnique', ['scope' => 'site_id']], 'provider' => 'table' ] ]); }}} In the above example, the email uniqueness will be scoped to only rows having the same site_id. Scoping will only be used if the scoping field is present in the data to be validated.
public validateUniqueExt ( mixed $value, array $options, array $context = [] ) : boolean
$value mixed The value of column to be checked for uniqueness
$options array The options array, optionally containing the 'scope' key
$context array The validation context as provided by the validation routine
리턴 boolean true if the value is unique

validateUrl() 공개 메소드

Options: - allowEmpty TRUE/FALSE (TRUE: if empty => return TRUE) - required TRUE/FALSE (TRUE: overrides allowEmpty) - autoComplete (default: TRUE) - deep (default: TRUE)
public validateUrl ( array | string $url, array $options = [], array $context = [] ) : boolean
$url array | string Full URL starting with http://...
$options array
$context array
리턴 boolean Success