NodeType relationships


I would like to specify a relationship between nodeTypes, one to many or many to many, what’s the best practice to go about it ?

Specifically in my case, I need a one-to-many relationship, so I was thinking of defining an array of NodeChildren into my parent NodeType definition, but that’s not exactly what I want (neither do I know how to do it). What I want, is to link existing nodeTypes into another nodeType, not creating new ones.

So, how do you define non-hierarchical nodeType relationships in Neos ?

UPDATE: To help you understand the problem better, I need to specify a list of users that belong to a team and then on the team’s page I will try to render the data of the team that the logged-in user belongs to. But the problem now is how to assign users to teams.

Thanks in advance !

You can use the type reference or references here:

      # Selecting a single team/reference
      type: reference
            nodeTypes: ['Your.Package:Team']
      # Selecting multiple teams/references
      type: references
      # the rest is the same as above

Then in your fusion file check if the member is linked:

prototype(Your.Package:Team) {
    members = Neos.Fusion:Collection {
        collection = ${q(site).find('[instanceof Your.Package:Member]')}
        itemName = 'member'
        itemRenderer = Neos.Fusion:Case {
            isInTeam {
                condition = ${Array.indexOf(q(member).property('teams'), node) >= 0}
                # if you use only a single team, use 
                # "${q(member).property('team') == node}" here.
                type = 'Your.Package:MemberInTeam' 
                # create custom prototype for output in team overview!
            default {
                condition = TRUE
                renderer = ''

Hope this helps and i didn’t miss sth. in my answer.

1 Like