By writing the $dataUser I get this error :
Database Error
Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column
'Tutor.id' in 'where clause'
SQL Query: SELECT COUNT(*) AS `count` FROM `tutors` AS `Tutor` WHERE
`Tutor`.`id` = '19'
Notice: If you want to customize this error message, create app\View
\Errors\pdo_error.ctp
On Mar 4, 6:38 pm, Tilen Majerle <tilen.maje...@gmail.com> wrote:
> now, user is saved ?
>
> if it's still not, then is problem FOR user in validation, after call
> save() method for User, debug($this->Tutor->User->validationErrors);
>
> i'm sure you failed with $this->request->data('PASSWORDTUTOR')
> --
> Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> 2012/3/4 Cédric Chabert <ced.chab...@gmail.com>
>
>
>
>
>
>
>
> > Thank you for this answer !
>
> > Actually there is validated beforeSave, and the password is hashed.
>
> > class User extends AppModel {
> > public $name = 'User';
>
> > public $hasOne = 'Tutor';
>
> > public $validate = array(
> > 'username' => array(
> > 'required' => array(
> > 'rule' => array('notEmpty'),
> > 'message' => 'A username is required'
> > )
> > ),
> > 'password' => array(
> > 'required' => array(
> > 'rule' => array('notEmpty'),
> > 'message' => 'A password is required'
> > )
> > ),
> > 'role' => array(
> > 'valid' => array(
> > 'rule' => array('inList', array('student','tutor')),
> > 'message' => 'Please enter a valid role',
> > 'allowEmpty' => false
> > )
> > )
> > );
>
> > public function beforeSave() {
> > if (isset($this->data[$this->alias]['password'])) {
> > $this->data[$this->alias]['password'] =
> > AuthComponent::password($this->data[$this->alias]['password']);
> > }
> > return true;
> > }
> > }
>
> > On Mar 4, 6:01 pm, Tilen Majerle <tilen.maje...@gmail.com> wrote:
> > > $dataUser should be something like this
>
> > > $dataUser = array('User' => array('username' => $this->request-
>
> > > >data('LOGINTUTOR'), 'password' => $this->request-
> > > >data('PASSWORDTUTOR'), 'role' => 'tutor'));
>
> > > and make sure that model is not validated before save, maybe here is
> > > problem too :)
> > > --
> > > Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> > > 2012/3/4 Cédric Chabert <ced.chab...@gmail.com>
>
> > > > $dataUser = array('username' => $this->request-
> > > > >data('LOGINTUTOR'), 'password' => $this->request-
> > > > >data('PASSWORDTUTOR'), 'role' => 'tutor');
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment