#4693: Containable, unable to pass conditions as an array
------------------------------------------------+---------------------------
    Reporter:  francky06l                       |         Owner:          
        Type:  Bug                              |        Status:  reopened
    Priority:  Medium                           |     Milestone:  1.2.x.x 
   Component:  Behaviors                        |       Version:  RC1     
    Severity:  Normal                           |    Resolution:          
    Keywords:  behavior containable conditions  |   Php_version:  n/a     
Cake_version:  1.2.0.6311 beta                  |  
------------------------------------------------+---------------------------
Changes (by Dieter_be):

  * status:  closed => reopened
  * resolution:  fixed =>

Comment:

 I'm afraid (I hope I'm wrong though) the problem is not fixed for deeper
 levels of associations.


 I have the following association structure (-> representing
 hasMany):[[BR]]
 A->B->C->D->E->F->G and I want only the A/B/C/D/E/F's that are coupled to
 at least one G where G.name IN ('a','b').[[BR]]
 So I do:
 {{{
 $this->paginate['A'] =
 array('contain'=>array('conditions'=>array('G.name'=> array('a','b')),
                                               'B' => array ('C' => array
 ('D' => array ('E' => array ('F' => array ('G')))))));

 }}}
 Cake/Containable does not generate a query, instead cake warns me:[[BR]]
 Model "A" is not associated with model "conditions"
 [CORE/cake/libs/model/behaviors/containable.php, line 340][[BR]]
 ContainableBehavior::containments() -
 CORE/cake/libs/model/behaviors/containable.php, line 340[[BR]]
 ContainableBehavior::beforeFind() -
 CORE/cake/libs/model/behaviors/containable.php, line 118[[BR]]
 ModelBehavior::dispatchMethod() - CORE/cake/libs/model/behavior.php, line
 160[[BR]]
 BehaviorCollection::trigger() - CORE/cake/libs/model/behavior.php, line
 456[[BR]]
 Model::find() - CORE/cake/libs/model/model.php, line 1946[[BR]]
 Controller::paginate() - CORE/cake/libs/controller/controller.php, line
 1063

 Without the conditions it works.

-- 
Ticket URL: <https://trac.cakephp.org/ticket/4693#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 tickets-cakephp@googlegroups.com
To unsubscribe from this group, send email to 
tickets-cakephp+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to