Tuesday, July 15, 2014

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

> saveAll fails with the following error:
> Warning (2): Illegal string offset 'user_id' [CORE/Cake/Model/Model.php, line
> 2094]

an update on this issue which is driving me mad. I returned to a working state using 2.0.6, and I just found out that whatever code I add to the model or to the controller raises the error. And this is completely WEIRD! Since I couldn't add the validator to the model I added a check to the controller. This is the patch:
diff --git a/app/Controller/UsersController.php b/app/Controller/UsersController.php
index 18b040d..08b87d6 100644
--- a/app/Controller/UsersController.php
+++ b/app/Controller/UsersController.php
@@ -449,6 +449,11 @@ public function login(){
$this->Session->setFlash($msg, 'flash_message');

if ($this->request->is('post')){
+ if ($this->User->find('count', array('conditions'=>array('email'=>$this->request->data['User']['email']))) > 0) {
+ $this->Session->setFlash(__('Your email address is already registered, please try the password recovery tool'), 'flas
+ $this->redirect("/users/login");
+ }
+

With *just this* code added the saveAll fails! How is this possible???
I tried deleting everything in tmp/cache/*/cake* but no change.
I am for sure missing something here. Is there any action I should do from Cake console to clear some other cache I don't know?

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: