Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compare Related Table column with Parent column #63

Closed
DregondRahl opened this issue Jul 31, 2011 · 1 comment
Closed

Compare Related Table column with Parent column #63

DregondRahl opened this issue Jul 31, 2011 · 1 comment
Labels
Milestone

Comments

@DregondRahl
Copy link

Model_Thread::find()->related('posts')->where('posts.id', '=', 'threads.last_post_id')->get();

The 'last_post_id' from the 'threads' table can be used to compare with the 'posts' table 'id'.

@jschreuder
Copy link
Contributor

Thought about this, I don't actually think it's a problem to require people to do t0.last_post_id in these cases. Any other way should be some collission preventing name like __base__ which is only longer. You can't use the base model name as it might relate to itself and you can't just use base as that would prevent a model named 'base' from working correctly. Thus I see no advantage in creating any alias for t0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants