Note that there are some explanatory texts on larger screens.

plurals
  1. POcakephp usermin password not saving
    primarykey
    data
    text
    <p>I am trying to edit a company and update the password which is in the umusers table. If I use save it updates the company but not the password in the umusers table. If I use saveAll it creates a new user in the umusers table.</p> <p>Here is my setup</p> <p>Company Model I have:</p> <pre><code> public $hasOne = 'Umuser'; </code></pre> <p>Company Controller</p> <pre><code>public function edit($id = null) { $this-&gt;Company-&gt;id = $id; if (!$this-&gt;Company-&gt;exists()) { throw new NotFoundException(__('Invalid company')); } if ($this-&gt;request-&gt;is('post') || $this-&gt;request-&gt;is('put')) { if ($this-&gt;Company-&gt;save($this-&gt;request-&gt;data)) { $this-&gt;Session-&gt;setFlash(__('The company has been saved')); $this-&gt;redirect(array('action' =&gt; 'index')); } else { $this-&gt;Session-&gt;setFlash(__('The company could not be saved. Please, try again.')); } } else { $this-&gt;request-&gt;data = $this-&gt;Company-&gt;read(null, $id); } } </code></pre> <p>var_dump of the $this->request->data:</p> <pre><code>array(2) { ["Company"]=&gt; array(12) { ["id"]=&gt; string(3) "157" ["member_number"]=&gt; string(6) "234234" ["name"]=&gt; string(5) "keith" ["address1"]=&gt; string(5) "keith" ["address2"]=&gt; string(5) "keith" ["county"]=&gt; string(5) "keith" ["limited"]=&gt; string(1) "0" ["tax_number"]=&gt; string(5) "keith" ["contact_name"]=&gt; string(5) "keith" ["phone"]=&gt; string(5) "keith" ["email"]=&gt; string(15) "keith@keith.com" ["payment_start"]=&gt; array(3) { ["month"]=&gt; string(2) "02" ["day"]=&gt; string(2) "01" ["year"]=&gt; string(4) "2013" } } ["Umuser"]=&gt; array(1) { ["password"]=&gt; string(6) "keith1" } } </code></pre> <p>I know at the moment I am not hashing the password or unsetting it if it is left blank. What am I missing, some relationship with the id's perhaps?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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