开发者

Have a Zend_Filter that has access to the database

Is it possible to have a Zend_Filter that has access to the database, for example for transforming a city name into a numeric开发者_如何学JAVA city id?


Yes it is possible. You can get your database like this $adapter = Zend_Db_Table::getDefaultAdapter()


There are validators that use the db like Db_RecordExists and Db_NoRecordExists. Look at the code of those and write your own Filter using the same approach.

Basically you just have to extend the Filter class and implement your own filter, what you do in there, is entirely up to you. In the end you just have to return the filtered value.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜