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

Unable to check if parent is valid when using custom build warning callback #26

Open
Pnoexz opened this issue Dec 18, 2019 · 3 comments · May be fixed by #27
Open

Unable to check if parent is valid when using custom build warning callback #26

Pnoexz opened this issue Dec 18, 2019 · 3 comments · May be fixed by #27

Comments

@Pnoexz
Copy link

Pnoexz commented Dec 18, 2019

When encountering a build issue, I want to log an error instead of throwing an exception because the rest of the tree is still usable. The default handler checks if a parent is valid by using $this->nodes which is not available or passed to the callback at build time.

@Pnoexz Pnoexz linked a pull request Dec 18, 2019 that will close this issue
@BlueM
Copy link
Owner

BlueM commented Oct 3, 2024

Admittedly – it’s embarrassing to react to this issue after almost five years. (Maybe you know that yourself: once something’s at the bottom of the inbox, it’s at the bottom of the inbox …)

Anyways, I am working on an improved version of the library, which hopefully fulfills everyone’s need. I do understand why you wish to have access to the nodes, but: wouldn’t it be more flexible to pass the Tree instance? In the callable, you could still use $tree->getNodes() to get all the nodes, but also do everything else, like getting root nodes.

@Pnoexz
Copy link
Author

Pnoexz commented Oct 3, 2024

It's all good, coding and maintaining a public library is time consuming. I don't even remember which project I was using this library for, and I likely ended up using my fork instead. Looking back at the code and my PR, it might be better passing $this instead, but I don't know how it would behave since this is all happening in the constructor

@BlueM
Copy link
Owner

BlueM commented Oct 3, 2024

Thanks for the speedy reply. Then the code will pass $this.

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

Successfully merging a pull request may close this issue.

2 participants