is it possible add condition into left join?

132 views
Skip to first unread message

Marek Lichtner

unread,
Dec 15, 2011, 7:50:29 AM12/15/11
to NotORM
e.g.
$software->application('author.id > 10');
SELECT application.*
FROM application
LEFT JOIN author ON application.author_id = author.id
WHERE (author.id > 10);

Exists any way how to do this?:
SELECT application.*
FROM application
LEFT JOIN author ON application.author_id = author.id AND (author.id
> 10);

Jakub Vrána

unread,
Jan 6, 2012, 3:52:03 AM1/6/12
to not...@googlegroups.com
No, it's not very NotORM-ish. What is a use-case for this?

Jakub Vrana

Yuri Kuznetsov

unread,
Jan 16, 2012, 6:46:13 AM1/16/12
to not...@googlegroups.com
Hi

I like your library and very appreciate the work you've done. 

I have similar question regarding JOINS.
Is it possible to get relationships with relation_type field specified. E.g. I want to get all comments which belong to the blog record.

Maybe something like this:
$row->bean_comment()->via('bean_id')->where('bean_type','Blog');

where bean_comment table has next fields:
* bean_id
* bean_type
* comment_id

Thanks

Jakub Vrana

unread,
Dec 21, 2013, 10:31:23 AM12/21/13
to not...@googlegroups.com, Yuri Kuznetsov
Hi,

Yes, this is supported. via() shouldn't be necessary.

Jakub
Reply all
Reply to author
Forward
0 new messages