Ticket #641 (closed Bug: wontfix)
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_
