Tuesday, July 15, 2014

Re: SaveAll fails when adding multiple checks to single model field

It might be worth upgrading to the latest master = 2.5
Its kinda nonsense to stick to 2.0 when there might be a great chance that this is fixed in the core in a current version
especially since upgrading inside 2.x is a few minutes total.
And I have seen dozens of cases where this actually did the trick - and people spent hours debugging where there would never have been the reason to do it in the first place... ;)

this also goes for all future issues you will encounter.
mark


Am Dienstag, 15. Juli 2014 14:24:01 UTC+2 schrieb Lorenzo Milesi:
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...@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: