#6171: [PATCH] TreeBehavior: Column 'parent_id' in where clause is ambiguous
--------------------------+-------------------------------------------------
    Reporter:  biesbjerg  |          Type:  Bug      
      Status:  new        |      Priority:  Medium   
   Milestone:  1.2.x.x    |     Component:  Behaviors
     Version:  1.2 Final  |      Severity:  Normal   
    Keywords:  tree       |   Php_version:  PHP 5    
Cake_version:             |  
--------------------------+-------------------------------------------------
 When deleting a site_item the tree tries to resync itself. This fails
 because both SiteItem has a field called parent_id as well as the
 associated model MenuItem has a field called parent_id.

 Attached patch contains small change that solves this issue. Basically it
 prefixes updates with the model name. Sorry, no testcase this time, all
 existing test cases continue to pass though.

 {{{
  SQL Error: 1052: Column 'parent_id' in where clause is ambiguous
 [CORE/cake/libs/model/datasources/dbo_source.php, line 514]

 Query: UPDATE `site_items` AS `SiteItem` LEFT JOIN `menu_items` AS
 `MenuItem` ON (`MenuItem`.`site_item_id` = `SiteItem`.`id`) LEFT JOIN
 `module_actions` AS `ModuleAction` ON (`SiteItem`.`module_action_id` =
 `ModuleAction`.`id`) LEFT JOIN `layouts` AS `Layout` ON
 (`SiteItem`.`layout_id` = `Layout`.`id`) LEFT JOIN `sites` AS `Site` ON
 (`SiteItem`.`site_id` = `Site`.`id`) LEFT JOIN `languages` AS `Language`
 ON (`SiteItem`.`language_locale` = `Language`.`locale`) SET
 `SiteItem`.`parent_id` = NULL WHERE `parent_id` = 555
 }}}

-- 
Ticket URL: <https://trac.cakephp.org/ticket/6171>
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
-~----------~----~----~----~------~----~------~--~---

  • [CakePHP : The Rapid Dev... CakePHP : The Rapid Development Framework for PHP

Reply via email to