-
Notifications
You must be signed in to change notification settings - Fork 398
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
Add support for conditional FK-s #487
Comments
I'd love to see a polymorphic association support in Propel. I believe you have a mistake in your SQL, it should be: FROM
object_log_entry ole
LEFT JOIN user u ON (ole.object_type='USER' AND ole.object_id=u.id) A similar (opposite) scenario is when we want to have a relation to a subset of a foreign table. E.g. <table name="user">
<foreign-key foreignTable="object_log_entry" >
<reference value="USER" foreign="object_type" />
<reference local="id" foreign="object_id" />
</foreign-key>
</table> that generates: FROM
user u
JOIN object_log_entry ole ON (ole.object_type='USER' AND ole.object_id=u.log_id) @brainartdev, would you be able to provide a PR? |
I'm not sure if the name |
I guess by trying to use Single Table Inheritance I was basicly trying to emulate an extra condition for a relation, essentially for the same goal as the above suggestion of allowing us to specify extra conditions on Foreign keys. Nice to see this being discussed and requested by others, not sure why this is not there already considering all the stuff you are able to pull with propel! |
Added support for polymorphic relations. Fixes #487.
I'd like to propose feature to add extra conditions for foreign keys, e.g:
Which would create something like:
Of course, this would imply that database-level FK is not created, cascading and stuff would be done by model.
The text was updated successfully, but these errors were encountered: