#4375: Bug in validation coupled with saveAll
-----------------------------------+----------------------------------------
    Reporter:  kiger               |         Owner:              
        Type:  Bug                 |        Status:  closed      
    Priority:  Medium              |     Milestone:  1.2.x.x     
   Component:  Model               |       Version:  RC1         
    Severity:  Normal              |    Resolution:  needmoreinfo
    Keywords:  saveall validation  |   Php_version:  n/a         
Cake_version:  1.2.x rev 6595      |  
-----------------------------------+----------------------------------------
Comment (by pidmyster):

 Replying to [comment:2 nate]:
 > I have no way of reproducing this bug from the information you provided,
 let alone fixing it.  We have test cases that cover this, please submit a
 diff against it with a case that fails and/or raises an error.

 V 1.2.1.9004
 I have come across this issue also, I haven't fully found what causes it
 but it may be that I was using a controller without a model, the model I
 did a saveAll to was included in the $uses array. Same issue - it was
 trying to add an index of my foreign key to the $saves array to an
 existing value under case 'hasMany' in the saveAll method of model.php
 (i.e. going 1 level too deep)with this line at about line 1557:

 $values[$i][$this->{$type}[$association]['foreignKey']] =  $this->id;

 without finding the underlying issue a safe patch I used is:

 if(!is_array($values[$i]))
 {
 $values[$this->{$type}[$association]['foreignKey']] =  $this->id;
 }
 else
 {
 $values[$i][$this->{$type}[$association]['foreignKey']] =  $this->id;
 }

 I will leave the ticket as closed until I produce a test case and
 investigate further.

 Also the fix provided by the previous poster didn't work for me so I had
 to change model.php

-- 
Ticket URL: <https://trac.cakephp.org/ticket/4375#comment:3>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to