Bug Report #4066

ORM queries alias tables in both singular and plural form in same query

Added by John Heathco almost 3 years ago. Updated almost 3 years ago.

Status:ClosedStart date:06/28/2011
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Modules:ORM
Target version:v3.2.0
Resolution:fixed Points:

Description

ORM queries should use the singular model name for aliasing tables. There is no consistency when using with() in loading related models:

ORM::factory('blog')->with('category')->find_all()

results in:

SELECT `category`.`id` AS `category:id`, `category`.`name` AS `category:name`, `blogs`.* FROM `blogs` LEFT JOIN `categories` AS `category` ON (`category`.`id` = `blogs`.`category_id`)

As you can see, blogs is referred to in the plural while categories is referred to in the singular. Both should be referred to in either singular or plural - I think singular as that is how models are loaded via ORM::factory()

Associated revisions

Revision 3fc6ecaf
Added by jheathco - almost 3 years ago

using singular aliases for all orm table references (refs #4066)

History

#1 Updated by John Heathco almost 3 years ago

  • Status changed from New to Closed
  • Resolution set to fixed

Also available in: Atom PDF