Skip to content

NodeCreation: childNodes constraints are not evaluated correctly if inserting items into Neos.Neos:ContentCollection #66

@patricekaufmann

Description

@patricekaufmann

When upgrading from 2.0.0 to 2.0.1, one template configuration stops working. Extract:

  options:
    template:
      childNodes:
        content:
          name: 'content'
          childNodes:
            text:
              type: 'KaufmannDigital.Nova.NodeTypes.Text:Atom.Text'

Apparently the exception is thrown at Classes/Domain/NodeCreation/NodeCreationService.php L97+


                if (!$parentNode->getNodeType()->allowsChildNodeType($nodeType)) {
                    $caughtExceptions->add(
                        CaughtException::fromException(new \RuntimeException(sprintf('Node type "%s" is not allowed for child nodes of type %s', $template->getType()->getValue(), $parentNode->getNodeType()->getName()), 1686417627173))
                    );
                    continue;
                }

The exception that's coming up:

RuntimeException(Node type "KaufmannDigital.Nova.NodeTypes.Text:Atom.Text" is not allowed for child nodes of type Neos.Neos:ContentCollection, 1686417627173)

I am not 100% certain yet but I think the issue is coming up because in that template we are inserting nodes into generic content collections, however the constraint is checked via allowsChildNodeType in NodeType, which however is not considering special constraints defined for those collections. The constraints are defined exeplicitely:

  childNodes:
    content:
      type: 'Neos.Neos:ContentCollection'
      constraints:
        nodeTypes:
          'KaufmannDigital.Nova.NodeTypes.Text:Atom.Text': TRUE

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions