本文整理匯總了PHP中Phalcon\Validation::bind方法的典型用法代碼示例。如果您正苦於以下問題:PHP Validation::bind方法的具體用法?PHP Validation::bind怎麽用?PHP Validation::bind使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Phalcon\Validation
的用法示例。
在下文中一共展示了Validation::bind方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: appendValidationMessageToTheNonObject
/**
* Tests the get
*
* @issue 10405
* @author Serghei Iakovlev <serghei@phalconphp.com>
* @since 2016-06-27
* @param IntegrationTester $I
*/
public function appendValidationMessageToTheNonObject(IntegrationTester $I)
{
$myValidator = new PresenceOf();
$validation = new Validation();
$validation->bind(new \stdClass(), ['day' => date('d'), 'month' => date('m'), 'year' => date('Y') + 1]);
$myValidator->validate($validation, 'foo');
$expectedMessages = Group::__set_state(['_position' => 0, '_messages' => [new Message('Field foo is required', 'foo', 'PresenceOf', 0)]]);
$I->assertEquals($expectedMessages, $validation->getMessages());
}
示例2: isValid
/**
* Check if the files abides by the current rule set
*
* @access public
* @return boolean
*/
public function isValid()
{
$validation = new Validation();
$file = new FileValidator($this->rules);
$validation->bind($file, $this->rawFiles);
$this->errors = $validation->validate();
return sizeof($this->errors) > 0;
}