tags:

views:

14

answers:

1

I have two database fields '$object->value' and '$object->max_value' and want to store the proportion in $object->percent_value without having a db field for it.

Is there a way to do this in a doctrine model?

A: 

You should have an ObjectBase class (obviously named something different) where the database attributes are defined. There should also be an Object class. Here you can define the percent_value attribute which calculates and returns the percentage on the fly.

BenV
thanks, this works
marco