public function validateAttribute($model, $attribute)
    {
        $result = $this->validateValue($model->$attribute);
        if ($result instanceof ExtendedPromiseInterface) {
            return $result->then(function($_result) use ($model, $attribute) {
                if (!empty($_result)) {
                    $this->addError($model, $attribute, $_result[0], $_result[1]);
                }
            });
        }
        if (!empty($result)) {
            $this->addError($model, $attribute, $result[0], $result[1]);
        }
        return null;
    }
public function validateAttribute($model, $attribute)
    {
        $result = $this->validateValue($model->$attribute);
        if ($result instanceof ExtendedPromiseInterface) {
            return $result->then(function($_result) use ($model, $attribute) {
                if (!empty($_result)) {
                    $this->addError($model, $attribute, $_result[0], $_result[1]);
                }
            });
        }
        if (!empty($result)) {
            $this->addError($model, $attribute, $result[0], $result[1]);
        }
        return null;
    }
public function validateAttribute ( $ model , $ attribute ) { $ result = $ this -> validateValue ( $ model -> $ attribute ) ; if ( $ result instanceof ExtendedPromiseInterface ) { return $ result -> then ( function ( $ _result ) use ( $ model , $ attribute ) { if ( ! empty ( $ _result ) ) { $ this -> addError ( $ model , $ attribute , $ _result [ 0 ] , $ _result [ 1 ] ) ; } } ) ; } if ( ! empty ( $ result ) ) { $ this -> addError ( $ model , $ attribute , $ result [ 0 ] , $ result [ 1 ] ) ; } return null ; }
Validates a single attribute.
Child classes must implement this method to provide the actual validation logic.
@param \Reaction\Base\Model $model the data model to be validated
@param string               $attribute the name of the attribute to be validated.
@return ExtendedPromiseInterface|null Some validators may return a promise if DB or other async components used
Validates a single attribute . Child classes must implement this method to provide the actual validation logic .