method Get and load model


I want to write Get method on a model. This method gets a sum of fields in a related table to this model. Before do it, I want to make sure that when I load the model if this function will be executed or only when I make a $model-> property.

I doubt for the performance, because it would be burdensome and is not necessary.

Thank you for making this possible!

if you create a new method in the mode… for example name getTotalSum()…

it will not be called automaticaly when you create a new model… it would be called only if you put that call in the constructor…

The method will be called when you explicitely request for it like