I have a manager page that has to go through validation, and I have the front end of the site that has to run through similar validation. While the two are not exactly the same, it would be nice to do the overlapping validation in one place. I have done some simple things, like the below code, but what if I had a field that cannot be blank, or make sure a date range doesn't overlap another date range? How would I read the error from the object class to the processor class so I could display the error?
class MyObject extends xPDOObject {
public function save($cacheFlag= null) {
if ($this->isNew()) {
$this->set('createdon','NOW');
} else {
$this->set('editedon','NOW');
}
$saved= parent :: save($cacheFlag);
return $saved;
}
}