Closed orloffv closed 13 years ago
What are these changes for? I don't understand what you're doing in your example code.
Also, have you run these changes through the test suite, to check they don't break anything else? It'd be good if you could make a unit test for this (and a pull request for it too).
Thanks
sry Jelly::query('page')->select_column('section.*')->join(array('page', 'section'), 'inner')->on('page.id', '=', 'section.pid')->execute()->as_array();
maybe on weekends i create tests
So you have a page table which has a relationship with itself. Each page has many sections, is that right?
Jelly isn't designed to be able to return a record and a 1-many relationship in the same query.
Alternatively you could create a parent section relationship, and query for all sections and specify that the parent post be included using with(...).
AFAIK, in either approach, Jelly won't spot the duplicate instances of the same model & primary key.
Jelly::query('page')->select_column('section.*')->join(array('page', 'section'), 'inner')->execute()->as_array();
generate sql error "Database_Exception [ 1146 ]: Table 'gds_dev.section' doesn't exist [ SELECT
section
.* FROMpage
ASpage
INNER JOINsection
ASsection
ON (page
.id
=section
.pid
) ]"