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

1:m self relation #123

Open
olaulau opened this issue Oct 16, 2023 · 1 comment
Open

1:m self relation #123

olaulau opened this issue Oct 16, 2023 · 1 comment

Comments

@olaulau
Copy link

olaulau commented Oct 16, 2023

hi ;

is it possible, and what would be the fieldConf of a 1:m self referring relationship ?
example :
employee table has a manager field, which is a foreign key to employee->id
this describes a tree, which we should traverse in both direction (up and down).

thanks.

@ikkez
Copy link
Owner

ikkez commented Oct 17, 2023

Yes it's possible. Simply point it to the model itself. Manager is a belongs to one field config and another field, i.e. "manages" can be added to fieldConf that is a has-many configuration, pointing to the manager-id field, which will contain all the child employees the manager will manage.

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

No branches or pull requests

2 participants