2 and 3 solutions would be for adding data to DB. We agreed that we add numbers to DB as they are. But if we get them from DB, then we change their format just to show them in a list. The easiest way and most time consuming is to add number_function to those numbers in templates, that I want to be formated. So I would copy from cache all partials which show numbers (like price,cost etc) and put echo number into number_format function. Do you think there is a quicker way?
2009/2/11 Martino Piccinato <[email protected]> > > I think you have three solutions: > > 1) Override getPrice method with something like > > public function getPrice() > { > $price = parent::getPrice(); > return number($price, 2); > } > > 2) Create your simple PriceFormWidget that will format your number > the way you want > > 3) Possibly cleaner: create your PriceValidator (not completely sure > at the moment but if I remember well by convention possible > transfromation of the form values are left to validators in symfony > please someone correct me if I'mwrong because I don't remember a > concrete example for this) > > Martino > > On Wed, Feb 11, 2009 at 4:29 PM, Tom Haskins-Vaughan > <[email protected]> wrote: > > > >> Tom Haskins-Vaughan > >> That is a nice solution, but how to trigger it for every number field? > >> Make it as some kind of filter? > > > > I don't know, I'm afraid. Anyone else? > > > > -- > > Tom Haskins-Vaughan > > Temple Street Media: Design and Development for the Web > > [email protected] | www.templestreetmedia.com > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---
