0

I'm currently searching for a solution for this Problem: I have a nested Tree, but the Leafs can be different types of Entities. For Example I have a Entity "Project", with children that can be of the type "Folder" or "Textfile", Folders having the possibility to have Children of their own again.

Since i couldn't find a solution: Is there a native Solution for this Problem (like using an Abstract Entity or Interface) or how would you solve this Problem?

Thanks in advance!

1 Answer 1

1

I dont see a proper solution with inheritance here, since the entities differ from each other.

What could be a solution; having a separate tree of lets call it items, and the items have an one-to-one relation to either project, folder or textfile. Furthermore you could build a proxy-like manager which allows you to call ->getObject() on the item.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, that's just what i feared... That was the first thing I wanted to try, but i could not find a way to Query the related Object from inside the Entity... I know there must be a way around that, but I couldn't find it...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.