title: cakephp 3 form validation for associated model data
body: <p>I need help with validation of associated model data. I have a form with User data (UsersTable) with additional fields from Model Companies (Users hasMany Companies).</p>
  
  <p>My form view look like this:</p>
  
  <pre><code>echo $this-&gt;Form-&gt;create($contentData);
    echo $this-&gt;Form-&gt;control('User.person_name');
    echo $this-&gt;Form-&gt;control('User.email');
    echo $this-&gt;Form-&gt;control('User.phone');
    echo $this-&gt;Form-&gt;control('Companies.0.company_name'); 
    //I try Companies.company_name too
    echo $this-&gt;Form-&gt;control('Companies.0.nip');
  </code></pre>
  
  <p>Action in controller look like this:</p>
  
  <pre><code>$userTable = TableRegistry::get('Users');
  $contentData = $userTable-&gt;newEntity(null, ['associated' =&gt; ['Companies']]);
  
  if ($this-&gt;request-&gt;is(['post', 'put'])) {
  
      $formData = $this-&gt;request-&gt;getData();
  
      $contentData = $userTable-&gt;newEntity($this-&gt;request-&gt;getData(),
          ['validate' =&gt; true, 'associated' =&gt; ['Companies']]);
  
      pr($contentData-&gt;getErrors());
      die();
  
  }
  </code></pre>
  
  <p>Unfortunately debug return error from UsersTable validation, except CompaniesTable.</p>
  
  <p>Could U any idea, where did i go wrong ? </p>