One of the issues with using static class variables is how they are
handled in subclasses.
class foo
{
protected static $_string = 'foo';
public function printString()
{
echo self::$_string;
}
}
class subfoo extends foo
{
protected static $_string = 'subfoo';
}
$subfoo = new subfoo();
$subfoo->printString(); // prints 'foo'
The implication is that when working with subclasses, if you override a
static property, you have to override all code that references that
static property, even if your code is identical to the code in the
parent class. This makes static properties painful to work with, so I
avoid them wherever possible.
Regards,
Bill Karwin
> -----Original Message-----
> From: Jack Sleight [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 15, 2007 1:29 AM
> To: Zend Framework General
> Subject: [fw-general] Zend_Validate static $_messageTemplates
>
> Off the back of the post by Ivo Trompert regarding changing
> the error messages returned by Zend_Filter_Input, would it be
> beneficial to make the $_messageTemplates property of each
> validator static? So they can be customised easily, validator
> wide, rather than per instance?
> --
> Jack
>