Note that there are some explanatory texts on larger screens.

plurals
  1. POCakephp saveAll continuously giving Array to string conversion error
    text
    copied!<p>I am developing an Application using 2 models, Users and profiles. when I am trying to editing both models at a time, I am getting continuously this error <strong>Array to string conversion [CORE\Cake\Model\Datasource\DboSource.php, line 1006]</strong> my <code>$this-&gt;request-&gt;data</code> array is in </p> <pre><code>array( 'User' =&gt; array( 'password' =&gt; '*****', 'id' =&gt; '6', 'first_name' =&gt; 'some', 'middle_name' =&gt; 'kjkj', 'last_name' =&gt; 'one', 'username' =&gt; 'kadjssa', 'group_id' =&gt; '5', 'mobile_no' =&gt; '7867868' ), 'Profile' =&gt; array( 'skype' =&gt; 'shrinet' ) ) </code></pre> <p>and my User controller edit function contain</p> <pre><code>public function editClient($id = null) { $this-&gt;User-&gt;id = $id; if (!$this-&gt;User-&gt;exists()) { throw new NotFoundException(__('Invalid user')); } debug($this-&gt;request-&gt;data); if ($this-&gt;request-&gt;is('post') || $this-&gt;request-&gt;is('put')) { $this-&gt;request-&gt;data['User']['user_id'] = $this-&gt;Auth-&gt;User('id'); $this-&gt;request-&gt;data['Profile']['user_id'] = $id; debug($this-&gt;request-&gt;data); print_r (debug($this-&gt;User-&gt;invalidFields())); if ($this-&gt;User-&gt;saveAll($this-&gt;request-&gt;data)) { $this-&gt;Session-&gt;setFlash(__('The user has been saved')); $this-&gt;redirect(array('action' =&gt; 'index')); } else { $this-&gt;Session-&gt;setFlash(__('The user could not be saved. Please, try again.')); } } else { $this-&gt;request-&gt;data = $this-&gt;User-&gt;read(null, $id); } $groups = $this-&gt;User-&gt;Group-&gt;find('list'); $this-&gt;set(compact('groups')); } </code></pre> <p>in debugging its giving</p> <pre><code>SQL Query: INSERT INTO `mvs`.`users` (`id`, `first_name`, `middle_name`, `last_name`, `username`, `password`, `group_id`, `mobile_no`, `user_id`, `modified`, `created`) VALUES (Array, Array, Array, Array, Array, Array, Array, Array, Array, '2013-07-05 00:07:13', '2013-07-05 00:07:13') </code></pre> <p>Please help me... thanks in advance</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload