NumberFormatter for entire ActiveRecord Attribute

Hey there,

for example: My AR attribute "price" expects comma representation of numbers (9,95 not 9,95).

Is there any way to define that in the ActiveRecord? So any input and output concerning " price" it already formated.

(Of course in the MYSQL-Table I can not use commas)

Best regards,

Peili

just override beforeSave and afterFind in your model, and you can have any transformation you want.

In some cases there also exist behaviors in the extension database, like i18n-datetime-behavior which might save you even more time.