Свойство | Тип | Описание | |
---|---|---|---|
$_data | array | ||
$schema | array | Initial document's data |
Метод | Описание | |
---|---|---|
__clone ( ) | Cloning not allowed because cloning of object not clone related aggregates of this object, so cloned object has links to original aggregates. This is difficult to handle. | |
__construct ( array $data = null, boolean | true $notModified = true ) | ||
__get ( $name ) | ||
__isset ( $name ) | ||
__set ( string $name, mixed $value ) | Handle setting params through public property | |
addError ( string $fieldName, string $ruleName, string $message ) : |
Add validator error from validator classes and methods. This error reset on every re-validation | |
addErrors ( array $errors ) : |
Add errors | |
addValidatorNamespace ( type $namespace ) : |
Add own namespace of validators | |
append ( type $selector, type $value ) : |
If field not exist - set value. | |
apply ( ) | Apply modified document fields as original | |
clearErrors ( ) | Clear triggered and validation errors | |
clearTriggeredErrors ( ) : |
Remove custom errors | |
get ( $selector ) | ||
getErrors ( ) : array | get list of validation errors | |
getModifiedFields ( ) | ||
getObject ( string $selector, string | callable $className = '\Sokil\Mongo\Structure' ) : object | Get structure object from a document's value | |
getObjectList ( string $selector, string | callable $className = '\Sokil\Mongo\Structure' ) : object | Get list of structure objects from list of values in mongo document | |
getOriginalData ( ) | ||
getScenario ( ) | ||
has ( $selector ) | ||
hasErrors ( ) | ||
isModified ( $selector = null ) | ||
isScenario ( $scenario ) | ||
isValid ( ) : boolean | check if filled model params is valid | |
jsonSerialize ( ) | ||
merge ( array $data ) : |
Merge array to current structure with setting modification mark | |
mergeUnmodified ( array $data ) : |
Merge array to current structure without setting modification mark | |
prepareToStore ( $value ) | ||
replace ( array $data ) | Replace data of document with passed. | |
reset ( ) | Replace modified fields with original | |
rules ( ) : array | Validation rules | |
set ( string $selector, mixed $value ) : |
Store value to specified selector in local cache | |
setNoScenario ( ) | ||
setScenario ( $scenario ) | ||
toArray ( ) | ||
triggerError ( type $fieldName, type $ruleName, type $message ) : |
Add custom error which not reset after validation | |
triggerErrors ( array $errors ) : |
Add custom errors | |
unsetField ( $selector ) |
Метод | Описание | |
---|---|---|
setDataReference ( array &$data ) : |
IMPORTANT! Do not use this method |
Метод | Описание | |
---|---|---|
getValidatorClassNameByRuleName ( $ruleName ) | ||
isEmbeddedDocument ( array $array ) | Check if array is sequential list | |
mergePartial ( array &$document, array $updatedDocument, string $prefix = null ) | Recursive function to merge data for Structure::merge() | |
mergeUnmodifiedPartial ( array &$target, array $source ) | Recursive function to merge data for Structure::mergeUnmodified() |
final public __clone ( ) |
public __construct ( array $data = null, boolean | true $notModified = true ) | ||
$data | array | data to initialise structure |
$notModified | boolean | true | define if data set as modified or not |
public addValidatorNamespace ( type $namespace ) : |
||
$namespace | type | |
Результат |
public append ( type $selector, type $value ) : |
||
$selector | type | |
$value | type | |
Результат |
public clearTriggeredErrors ( ) : |
||
Результат |
public getObject ( string $selector, string | callable $className = '\Sokil\Mongo\Structure' ) : object | ||
$selector | string | |
$className | string | callable | string class name or closure, which accept data and return string class name |
Результат | object | representation of document with class, passed as argument |
public getObjectList ( string $selector, string | callable $className = '\Sokil\Mongo\Structure' ) : object | ||
$selector | string | |
$className | string | callable | Structure class name or closure, which accept data and return string class name of Structure |
Результат | object | representation of document with class, passed as argument |
public mergeUnmodified ( array $data ) : |
||
$data | array | |
Результат |
protected setDataReference ( array &$data ) : |
||
$data | array | reference to data in external code |
Результат |
public triggerError ( type $fieldName, type $ruleName, type $message ) : |
||
$fieldName | type | |
$ruleName | type | |
$message | type | |
Результат |
public triggerErrors ( array $errors ) : |
||
$errors | array | |
Результат |