title: CakePHP- Saving Related Model Data
body: <p>Ok, lets say there are two associated models, where the main model has a hasMany relationship with the other model. ex Donor hasMany Donations. I have read most of cake's documentation and I also took note of this (from the doc):</p>
  
  <blockquote>
    <p>'When working with associated models, it is important to realize that
    saving model data should always be done by the corresponding CakePHP
    model. If you are saving a new Post and its associated Comments, then
    you would use both Post and Comment models during the save operation'(<a href="http://book.cakephp.org/2.0/en/models/saving-your-data.html" rel="nofollow noreferrer">http://book.cakephp.org/2.0/en/models/saving-your-data.html</a>)</p>
  </blockquote>
  
  <p>And as also pointed out by @burzum on another one of my questions : <a href="https://stackoverflow.com/questions/21468040/cakephp-controller-or-no-controller/21469207?noredirect=1#comment32413696_21469207">CakePHP - Controller or No Controller?</a> , I am still struggling on how to decide which works best. </p>
  
  <p>So taking the 'Donor and Donation' example mentioned earlier, let's say we want the user to add  donation to a donor.  So for the user to add a donation, one would need to view a donor, accessing a url of the sort : 'domain/donors/view/1', meaning the user is currently viewing donor with id of 1. Then within that view, let us assume there is button which allows the user to add a donation. Now from what I have been told and from what I read, the add(donation) action should belong to the donationsController. </p>
  
  <p>Let us also assume that the add(donation) action has its own view.. So if I am at 'domain/donors/view/1' the user is redirected to 'domain/donations/add/donor_id:1' where the id of the donor is then retrieved using 
  <code>$this-&gt;request-&gt;params['named']['post_id']</code> 
  and  set to the FK like so : 
  `$this->request->data['Donation']['donor_id'] = $id;</p>
  
  <p>But I have a gut feeling telling me that this is not the proper way to go and it feels like bad practice jumping from one controller to the other, when having associated models. </p>
  
  <p>Any insight on this ? Is there a general rule of thumb one could apply or follow ? Is it ok to redirect the user from the donorsController's view action to the donationsController's add action ? </p>
  
  <p>Thanks in advance! </p>