title: CakePHP data change during validation and beforeSave is not being save with the changes
body: <p>I'm saving data sent from a form. </p>
  
  <p>In the Controller I am doing :</p>
  
  <pre><code>$this-&gt;User-&gt;create();
  $this-&gt;User-&gt;save($this-&gt;request-&gt;data)
  </code></pre>
  
  <p>The $this->request->data looks like this:</p>
  
  <pre><code>'User' =&gt; array(
      'password' =&gt; '*****',
      'username' =&gt; 'ddddd',
      'role' =&gt; '256/aa01bdf80d42beb48dd3225acddf447fdd7a39f3',
      'parent_id' =&gt; '0/b6ba9bd57f6c70cf738891d4c6fac22abed4161d'
  )
  </code></pre>
  
  <p>There are validation rules that works on 'role' and 'parent_id' to insure the role/parent ids are among those the user can access.</p>
  
  <p>The validation changes the field values if the data is valid.</p>
  
  <p>I also have a Tree behavior that is setting some tree fields in a beforeSave() filter in the behavior.</p>
  
  <p>The validation rule is writing the change to <code>$this-&gt;data-&gt;[$model][$field]</code> as shown below.</p>
  
  <pre><code>public function checkListHash($check, $field) {
      $explodedCheck = explode('/', $check[$field]);
      if ($this-&gt;secureId($explodedCheck[0], $explodedCheck[1])) {
          $this-&gt;data['User'][$field] = $explodedCheck[0];
          return true;
      }
      return false;
  }
  </code></pre>
  
  <p>The beforeFilter() in the behavior is changing the data array with statements like this:</p>
  
  <pre><code>$Model-&gt;data[$Model-&gt;alias][$ancestors] = $ancestorList;
  </code></pre>
  
  <p>When validation and the beforeFilter() processing is complete, I have a beautiful and correct array of data at <code>$this-&gt;User-&gt;data</code> that looks like this:</p>
  
  <pre><code>'User' =&gt; array(
      'password' =&gt; '*****',
      'active' =&gt; '0',
      'role' =&gt; '256',
      'parent_id' =&gt; '0',
      'node' =&gt; '0',
      'username' =&gt; 'ddddd',
      'modified' =&gt; '2013-09-15 09:55:02',
      'created' =&gt; '2013-09-15 09:55:02',
      'ancestor_list' =&gt; ',0,'
  )
  </code></pre>
  
  <p>However, <code>$this-&gt;request-&gt;data</code> is unchanged. And that is what is being save.</p>
  
  <p>Clearly I'm not understanding the relationship of these various ways to get to the data. I've tried a variety of ways to address the data in the three contexts:</p>
  
  <ul>
  <li>Controller</li>
  <li>Model</li>
  <li>Behavior</li>
  </ul>
  
  <p>And I've tried <code>$this-&gt;User-&gt;create($this-&gt;request-&gt;data);</code> before the Controller save() statement.</p>
  
  <p>In the controller, what I'm seeing as available data arrays:</p>
  
  <ul>
  <li>PRIOR TO THE SAVE</li>
  <li>$this->request->data = $this->data = proper data from the form</li>
  <li><p>$this->User->data = some default, unpopulated array</p></li>
  <li><p>PRIOR TO THE SAVE when I use $this->User->create($this->request->data)</p></li>
  <li><p>all three arrays contain raw form data</p></li>
  <li><p>AFTER THE SAVE in either case</p></li>
  <li>$this->request->data = $this->data = exactly as before</li>
  <li>$this->User->data = the properly massaged data</li>
  </ul>
  
  <p>Can anyone sort me out?</p>
  
  <p>Don Drake</p>