Hi,

Is it possible to override model validation in the record template in Doctrine?

I have created a behaviour and a class that extends Doctrine_Template with it, 
and trying to add generic validation to all models that have this specific 
behaviour enabled, like this:
public function validate()
{
  $this->getInvoker()->validate();
  if(strlen($this->getInvoker()->getName()) < 1) 
  {
    $errorStack = $this->getInvoker()->getErrorStack();
    $errorStack->add('name', 'Name not provided');
  }
}

However this method is never called when I try validate() on a record, I guess 
that is because there already exists method sfDoctrineRecord::validate() .

Is there another way to override the validate() method using a template?

Regards,
Ken
--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to