I have a model which is referenced to a table registries extending Zend_Db and some methods which bascially uses fetchAll() all the time.
What happens is: my table has a DATE field and I’d like it to output already formated when I call $row->reg_date. Is it possible by doing something in the model or do I have to manually format?
You’ve got a couple of options:
Zend_Db_Table_Row_Abstract::__get()in your table when asking for thereg_date<?= $this->formatDate($this->row->reg_date, 'fancy'); ?>Doctrine probably has the answer you would like, the following is cut from http://www.doctrine-project.org/documentation/manual/1_2/en/introduction-to-models#generating-models:
If I were you, I’d go with the view helper-option. You could add custom CSS there and have it all ready to go. If you’d need it changed, you’d change it in one place and your application’s renewed.
Besides, if you ever wanted to do something with the date (compare it to another date, get just the month, localize it, etc.) you want a clean starting point which is what you’d store in the database (i.e.
2010-05-16or2010-05-16 16:55:00). Therefore: view settings belongs in the view.