Bug Report #4066
ORM queries alias tables in both singular and plural form in same query
| Status: | Closed | Start date: | 06/28/2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due 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
using singular aliases for all orm table references (refs #4066)
History
Updated by John Heathco almost 2 years ago
- Status changed from New to Closed
- Resolution set to fixed