diff --git a/app/Model/DreamjobCvEntry.php b/app/Model/DreamjobCvEntry.php index fbf0f8f..3d13cb2 100644 --- a/app/Model/DreamjobCvEntry.php +++ b/app/Model/DreamjobCvEntry.php @@ -85,6 +85,9 @@ class DreamjobCvEntry extends AppModel { //'last' => false, // Stop validation after this rule //'on' => 'create', // Limit validation to 'create' or 'update' operations ), + 'compare' => array( + 'rule'=>'compareDates' + ) ), 'enddate' => array( 'date' => array( @@ -119,7 +122,10 @@ class DreamjobCvEntry extends AppModel { ); //The Associations below have been created with all possible keys, those that are not needed can be removed - + public function compareDates() + { + return ($this->data[$this->alias]['startdate'] < $this->data[$this->alias]['enddate']) ? true : false; + } /** * belongsTo associations *