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

RootNode query does not return the correct node (returns null) #48

Open
breadlesscode opened this issue Oct 22, 2021 · 3 comments
Open

Comments

@breadlesscode
Copy link
Contributor

Hi,

first thanks for this great Package. I really like the idea of storing the nodes outside the normal node tree. ❤️

But in my current setup the query for finding the current root node doesn't work. Everytime the getRootNode() Method is called, a new root node is created. I found this code lines with the todo comment. Is it a known problem?

// return existing root-node
//
// TODO: Find a better way to determine the root node
$taxonomyDataRootNodeData = $this->nodeDataRepository->findOneByPath(
'/' . $this->getRootNodeName(),
$context->getWorkspace()
);

I'm looking for a better way to query the root node, but found nothing. Any ideas why this returns null?

I'm trying to fix it, but I don't know if I can.

Versions:
neos/neos 7.2.0
neos/neos-ui 7.2.1

And thanks again for the work :)

@breadlesscode
Copy link
Contributor Author

breadlesscode commented Oct 22, 2021

One possible solution could be the use of findByPathWithoutReduce() instead of findOneByPath().

e.g.:

$taxonomyDataRootNodeData = $this->nodeDataRepository->findByPathWithoutReduce(
     '/' . $this->getRootNodeName(),
      $context->getWorkspace()
);
$taxonomyDataRootNodeData = current($taxonomyDataRootNodeData);

if ($taxonomyDataRootNodeData !== null && $taxonomyDataRootNodeData !== false) {
   …

But I have no idea which side effects this solution might have.

@jobee
Copy link

jobee commented Oct 26, 2021

I've seen this too in Neos 7.2 (only in local dev environment, not in production)
@breadlesscode your described workaround works for me

@breadlesscode
Copy link
Contributor Author

@jobee With my project, it's the other way around. Production has problems, dev not. And even if I import the live DB.

You can require the branch new-root-node-query-logic from my fork until we have fixed the error.

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

No branches or pull requests

2 participants