atk4 / atk4-addons

Agile Toolkit Addons
http://atk4.com/
Other
15 stars 23 forks source link

Update hierarchy/lib/Form/Field/drilldown.php #19

Closed DarkSide666 closed 12 years ago

DarkSide666 commented 12 years ago

This also restricts to use this element in non-self-hierarchial models, so we better comment out this restriction for better usability in different situations.

DarkSide666 commented 12 years ago

If we have hierarchical model and want to show drilldown for parent_id field, then this restriction is logical. It will prevent us to set parent_id = id or parent_id = (one of the children of current record). That way we can restrict to create loops.

But if we use drilldown field for not hierarchical model A (field A.b_id) which relates to hierarchical model B (B.id and also have B.parent_id), then we need to show all possible values (including already set A.b_id and it's children) and don't restrict something. This way there will be no loops anyway - it's just relation from model A to model B.

Maybe instead to editing this drilldown field class I should better create new parameter of this class or even new class which extends this and disables or enable this restriction... This also should be backwards compatible.

For now, please don't accept this pull request. Let's think about how to make this better - new parameter to this class or another class which inherits this and takes off this restriction. How you think?

romaninsh commented 12 years ago

Maybe we can somehow compare the models if the IDs are coming from different model classes ?

DarkSide666 commented 12 years ago

Yeah, probably you're right. If Models are the same, then we should restrict looping, otherwise allow. I'll check that in next few days.

DarkSide666 commented 12 years ago

OK this is solved now. I'll make new pull request right away. Please accept this change.