mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-17 23:09:10 +08:00
Changed validateFile() method access from protected to public, fixed hasErrors check
This commit is contained in:
@@ -168,7 +168,7 @@ class FileValidator extends Validator
|
|||||||
* @param string $attribute the attribute being validated
|
* @param string $attribute the attribute being validated
|
||||||
* @param UploadedFile $file uploaded file passed to check against a set of rules
|
* @param UploadedFile $file uploaded file passed to check against a set of rules
|
||||||
*/
|
*/
|
||||||
protected function validateFile($object, $attribute, $file)
|
public function validateFile($object, $attribute, $file)
|
||||||
{
|
{
|
||||||
switch ($file->error) {
|
switch ($file->error) {
|
||||||
case UPLOAD_ERR_OK:
|
case UPLOAD_ERR_OK:
|
||||||
|
|||||||
@@ -145,11 +145,11 @@ class ImageValidator extends FileValidator
|
|||||||
* @param string $attribute the attribute being validated
|
* @param string $attribute the attribute being validated
|
||||||
* @param UploadedFile $file uploaded file passed to check against a set of rules
|
* @param UploadedFile $file uploaded file passed to check against a set of rules
|
||||||
*/
|
*/
|
||||||
protected function validateFile($object, $attribute, $file)
|
public function validateFile($object, $attribute, $file)
|
||||||
{
|
{
|
||||||
parent::validateFile($object, $attribute, $file);
|
parent::validateFile($object, $attribute, $file);
|
||||||
|
|
||||||
if (false === $object->hasErrors($attribute)) {
|
if (!$object->hasErrors($attribute)) {
|
||||||
$this->validateImage($object, $attribute, $file);
|
$this->validateImage($object, $attribute, $file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user