f3-cortex
f3-cortex copied to clipboard
1:m self relation
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.
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.