Ticket #641 (closed Bug: wontfix)

Opened 5 months ago

Last modified 4 months ago

ORM : select()->find_related_

Reported by: Delapouite Owned by: Shadowhand
Priority: minor Milestone:
Component: Libraries:ORM Version: SVN HEAD
Keywords: Cc:

Description

A short example to illustrate the problem :

Post belongsto Author
Author hasmany Posts

To retrieve all the posts of an author :

$author = new Author(1);
$posts = $author->find_related_posts();

If I just want to retrieve posts titles, I try
$posts = $author->select('title')->find_related_posts();

It works quite well, except that there is a nefast redundancy in SELECT part of the generated SQL :
SELECT title, posts.* FROM posts WHERE author_id = '1'

It still get all the fields instead of just title :
SELECT title FROM posts WHERE author_id = '1'

For the moment I fix this problem by adding : $model->select = $this->select;

in the ORM library, call method dealing with find_related_

Change History

Changed 5 months ago by Nowaker

I confirm, the bug really exists. Unwanted table.* appears regardless of invoking select('one_column').

Changed 4 months ago by Shadowhand

  • status changed from new to closed
  • resolution set to wontfix

This can't be fixed in the current ORM, due to the internal structure, but is fixed in the ORM in trunk.

Changed 4 months ago by anonymous

  • milestone deleted

Milestone 2.1.3 deleted

Note: See TracTickets for help on using tickets.