Friday
26
June
2009

Namespaces for Filters and Validators

Hy all,

I added a new feature for Zend_Filter and Zend_Validate.

As you may know you can use Zend_Filter, and also Zend_Validate, in a statical way.
When using them static, you have to give the namespaces where your own filters can be found. Otherwise it recognises only the delivered filters from Zend.

Zend_Filter::get('123abd', 'Tokenize', array(), array('My/Path', 'My/Module/Path'));

As you may imagine this can get complicated when you are using multiple self designed filters or multiple namespaces.

Now you can set default namespaces which will be used within the whole application.

Zend_Filter::setDefaultNamespaces(array('My/Path', 'My/Module/Path'));
Zend_Filter::get('123abd', 'Tokenize');
Zend_Filter::get('other123'), 'Digits');

The usage is now much simpler as you can set the namespaces once within your bootstrap or application.
Available methods are:

* setDefaultNamespaces
* addDefaultNamespaces
* getDefaultNamespaces
* hasDefaultNamespaces

The same methods are available for Zend_Validate.

Greetings
Thomas Weidner
I18N Team Leader, Zend Framework

Zend Framework Advisory Board Member
Zend Certified Engineer for Zend Framework

Back to top

Add comment

Fill out the form below to add your own comments

User data




Add your comment