Ch.6 — Getproject And Getuseroptions

In Chapter 6 (Iteration 3: Fixing the owner and requester fields), the author has us create two methods which will allow us to pull the list of users assigned to the Issue’s project. The finished line in the form looks like this:


<?php echo $form->dropDownList($model, 'requester_id', $this->getProject()->getUserOptions()); ?>

.

I understand how and why each of the two methods work. What I don’t understand is why the getProject method is in the Issue Controller but the getUserOptions method is in the Project Model. My best guess is that — generally — these methods would always be in the model, but since we had already created the _project array for the actionCreate() method in the Issue Controller, it was simpler to reference it there (rather than create a second one).

Any insight here would be fabulous!

Thanks in advance.

getProject was created to get the Project model when you are the controller. getUserOptions was implemented in the model because model is about data and known which user options are there, controller does not know that.

Why should a project model have a method getProject?