#5505: Tree behavior setting scope => Model does not work
--------------------------+-------------------------------------------------
    Reporter:  xumix      |         Owner:          
        Type:  Bug        |        Status:  reopened
    Priority:  Medium     |     Milestone:  1.2.x.x 
   Component:  Behaviors  |       Version:  RC2     
    Severity:  Normal     |    Resolution:          
    Keywords:             |   Php_version:  n/a     
Cake_version:             |  
--------------------------+-------------------------------------------------
Changes (by iGloo):

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

Comment:

 I did run with the same problem today after fixing the UUID issue as
 primary key.

 Case: Cakephp manages several projects. Each projects can have webpages.
 The TreeBehavior allows creating a websites out of these webpages.

 Set the webpage behavior as follow: actsAs = array('Tree'=>array('scope'
 => 'Project'));

 Add new nodes from project 1 into the tree and after, add nodes from
 project 2 into the tree.

 Each projects are different from each other, they do not share anything
 besides the DB.


 When re-ordering nodes from project 1 with movedown, the treebehavior
 should see the end of the pages associated with the project they are in.
 (Let say there is 3 pages, we should not be able to move down more than 3
 times the first element). The current behavior will go down the list and
 mix with the other projects ordering. ie: moving up project 2 first page
 will work, but the position for that project did not change.

 Fix in the controller is to re-associate the tree behavior as follow
 before each moveup/movedown/save:

 {{{
 $this->Webpage->DirectoryNode->Behaviors->detach('Tree');
 $this->Webpage->DirectoryNode->Behaviors->attach('Tree', array('scope' =>
 array('project_id' => $project_id)));
 }}}

 That way, the behavior now sees the right ordering and will block going up
 or down the limit of the project tree.

-- 
Ticket URL: <https://trac.cakephp.org/ticket/5505#comment:7>
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