Is there any nice way to achieve something like this?:
I have a model Work, Work has 2 HAS_MANY relations and 1 HAS_ONE relation:
now when I am building a form for a new Work model, I have to do all the needed logic in the model controller create action, example:
$model = new Work; $incomes = array(new Income); $tasks = array(new Task); $assignee = new User $this->render('form_fom_creating_new_work_record', array(/*all the models I created*/));
The thing I am thinking of, is invoking some magic for example in afterConstruct() method, to create those needed models and attach them to relations of Work, so that I don’t have to remember, to do it everywhere in the code elswhere I will use new Work;
Did you practice that, do you thinks it’s very wrong or rather usefull for you too?