A $once constraint is evaluated once at construct time. It will be evaluated when the attribute is given its default value. If the constraint depends on other attributes in the same class, there will be a problem, because there is no particular order of initialization specified. In the case where you have mutually dependent attributes that you want to initialize once, you would be better off using an onconstruct method.

On 2007-01-31, at 13:18 EST, Antun Karlovac wrote:

Maybe I should rephrase that last question: "is there a situation where you would have to worry about init order with $once{} constraints?

-Antun


Antun Karlovac wrote:
Yes usually I'd use $once{}, but I'm sure that there have been times when I've had to use a $always{} (i.e. ${}) constraint because of init order issues. Do $once{} constraints do the same checking-for-init that normal constraints do?
-Antun

Reply via email to