Tuesday, July 15, 2014

SaveAll fails when adding multiple checks to single model field

I have a model with an email field, the validator definition of the field is this:
'email' => array(
'email' => array(
'rule' => 'email',
'message' => 'Please specify a valid email address',
),
),

and it works. As soon as I add an isUnique validator to the same field:
'email' => array(
'email' => array(
'rule' => 'email',
'message' => 'Please specify a valid email address',
),
'unique' => array(
'rule' => 'isUnique',
'message' => 'This email address has already been registered',
),
),

saveAll fails with the following error:
Warning (2): Illegal string offset 'user_id' [CORE/Cake/Model/Model.php, line 2094]
I'm getting mad about this! I'm using Cake 2.0.6.

thanks
--
Lorenzo Milesi - lorenzo.milesi@yetopen.it

YetOpen S.r.l. - http://www.yetopen.it/

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: