Created
December 19, 2012 16:55
-
-
Save stev/4338235 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// getValue - и есть правельное актуальное значение (собственно что от формы и требуется) | |
// getActualValue - только правельное значение но без (default) | |
// getRawValue - исходное значение | |
$prm = Primitive::integer('id')-> | |
import(['id'=>1]); | |
var_dump( | |
$prm->getValue(), // int: 1 | |
$prm->getRawValue(), // string: 1 | |
$prm->getActualValue(), // int: 1 | |
$prm->getError() // null | |
); | |
$prm = Primitive::integer('id')-> | |
import(['id'=>'']); | |
var_dump( | |
$prm->getValue(), // null | |
$prm->getRawValue(), // string: '' | |
$prm->getActualValue(), // null | |
$prm->getError() // null | |
); | |
$prm = Primitive::integer('id')-> | |
required()-> | |
import(['id'=>'']); | |
var_dump( | |
$prm->getValue(), // null | |
$prm->getRawValue(), // string: '' | |
$prm->getActualValue(), // null | |
$prm->getError() // error:MISSING | |
); | |
$prm = Primitive::integer('id')-> | |
setDefault(4)-> | |
import(['id'=>'']); | |
var_dump( | |
$prm->getValue(), // 4 | |
$prm->getRawValue(), // string: '' | |
$prm->getActualValue(), // null | |
$prm->getError() // null | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment