Skip to content

Commit

Permalink
Merge pull request #32 from wernerkrauss/UseDataValue
Browse files Browse the repository at this point in the history
use ->dataValue() instead of ->Value() for better comparison, fixes #30
  • Loading branch information
sheadawson committed Mar 6, 2015
2 parents 1c3223b + 49a97d5 commit 8628217
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion code/ValidationLogicCriterion.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function phpOperator(){
* @return string
**/
public function toPHP(){
$value1 = '$fields->dataFieldByName(\'' . $this->master . '\')->Value()';
$value1 = '$fields->dataFieldByName(\'' . $this->master . '\')->dataValue()';
$value2 = $this->value;

if($operator = $this->phpOperator()){
Expand Down
10 changes: 5 additions & 5 deletions code/ZenValidatorConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ public function removeParsley() {
}

function validate($value) {
return $this->getTargetField()->Value() == $value;
return $this->getTargetField()->dataValue() == $value;
}

function getDefaultMessage() {
Expand Down Expand Up @@ -815,16 +815,16 @@ function validate($value) {
switch ($this->type) {
//Validates that the value is greater than another field's one
case self::GREATER:
return $value > $this->getTargetField()->Value();
return $value > $this->getTargetField()->dataValue();
//Validates that the value is greater than or equal to another field's one
case self::GREATER_OR_EQUAL:
return $value >= $this->getTargetField()->Value();
return $value >= $this->getTargetField()->dataValue();
//Validates that the value is less than another field's one
case self::LESS:
return $value < $this->getTargetField()->Value();
return $value < $this->getTargetField()->dataValue();
//Validates that the value is less than or equal to another field's one
case self::LESS_OR_EQUAL:
return $value <= $this->getTargetField()->Value();
return $value <= $this->getTargetField()->dataValue();
default:
throw new Exception('Invalid type : ' . $this->type);
}
Expand Down

0 comments on commit 8628217

Please sign in to comment.