How can I retrieve a model with all associations ?
I have a model Survey with an associated list of Question models. The Question Model has a few subclasses. Managing the surveys are not my problem. But I tried to do a simple clone for a survey with all questions and the "Clone" and "deepClone" methods from community commons module only "copies" the first stage, no associations. In the debugger I found out that my source model does not have the associated questions. Is that normal? How do I retrieve an model from the database with all associations included? Like a deep_retrieve :) I also need the model with all associations to provide that one json as a mobile API.
DeepClone is supposed to copy relations and related objects as well. Are you talking about relations for which the cloned object is the "owner"? This means in the domain model, the relation arrow starts at the object you want to clone. If the arrow points at that object (i.e. the reverse), the relation won't be cloned automatically, since it is not present in the cloned object, but in the other object of the relation. To have these cloned as well, include the relation name in the "ReverseAssociations" parameters of the deepClone action.