Closed badpenguin closed 11 years ago
Just do your join against the instance you get back from Model::factory() as you would with ORM::for_table().
understood, but what if i want a model that acts as a "view" ? i want my Article model to be the results of the query below, not just a single table
ORM::for_table('cms_content')->table_alias('c1') ->join('cms_content2','c2.cms_id=c1.cms_id','c2') ->where('c2.cms_lng', 'IT' )
I am not sure I understand. If you join on another table to your model then you'll get the columns from that table as well.
OK i'll make some test about it.
I would also know if there is a way to exec raw query for "update" and "delete" as well as for raw_query(), the doc isn't clean about this too.
OK i tested it. Fields from C2 are in the results sets BUT if i try to use "->set" on a field from the joined table "c2" it return the PHP error "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'google_rss_ts' in 'field list' exception generated at idiorm-master/idiorm.php:349 in function "execute" because, from query logs, it try to update the 1st table always
That is not supported. Once you use a join it is not possible to then update. The ORM has no idea where that field came from. This will not be implemented.
Hello, from the doc of Paris i was unable to find out how to translate this from idiorm into paris:
Its more like a 1to1 because i always filter the detail table by the language code