-
Notifications
You must be signed in to change notification settings - Fork 95
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
Model_Nestedset dump_tree() relations #301
Comments
Hm. It looks like that this works when the magic get method always returns a reference and as_object is true, even if the property does not exists. EAV still does not work. |
OK. This issue is in connection with #300 which has been solved I think. |
Here is the status: I reopen this issue, because the relations are NOT set for children when using dump_tree(). So the problem: relations are only set for the root node and not for all. |
Actually this issue is true for all collection methods. (The dump_tree uses them too). So these collection methods should have an argument for having the same relations loaded as the parent.
Another option is to have a relate() function on Model_Nestedset, which modifies the _node_operation and inserts a relation index with the desired relations as an array. ( I started to test it out, but I am waiting for your response about it. |
@stevewest can you check this out? |
@sagikazarmark I do not know anything about the implementation of nested sets. We all have full time jobs as well as working on fuel so have a little patience 😄 |
OK 😄 |
There is no support for relations whatsoever when using nested sets, all methods operate on the current model only. dump_tree() operates on a nested set model instance, which will be used as root of the nested sets tree. I think adding logic to figure out which relations the root node had loaded, and then fetch these for all other nodes too might potentionally be a bad idea, I may have a lot, some may be lazy loaded, etc. |
The actual use case is a menu model using EAV to be able to define custom attributes, so when editing a menu item you definitely can use a relation as you are operating on one model. The same for adding end deleting. The only problem is dump. Maybe I could define columns for the model without EAV, but using EAV for this would be cool. 😄 But I absolutely understand your point, and thought this might be a bad idea, so I this is why I suggested to set the required relation in the collection method ( I don't think using relations with nested sets is a problem. Why do you think it is? |
I don't think it is. The issue that I have is that if the model has 10 related models, and the root has 8 of them fetched, and your tree contains 200 nodes, automatically fetch all related objects the root has loaded will cause at least 1600 objects to be created when you dump the tree, and potentionally a lot more if they are "many" relations. I'll add support for related(), using same syntax as on a normal model query, so you can do what you have suggested. |
Model_Nestedset does not load relations or EAV.
It loads relation in the root element, but not in the children.
Relations are not dumped when dumping into multi-dimensional array.
The text was updated successfully, but these errors were encountered: