Neos custom domain entity?

Hi community! I have faced the following problem and I want to know what is the way to solve it in NEOS.

Often we need domain objects inside our project or website. It can be ‘car’, ‘vacancy’ or anything else. Of course such entities usually have own properties. Normally we call such objects as model or entity. Then we add them to DB via back-end and then we can display them on the website.

So how does it work on NEOS cms ?

So tell me please what is common approach for this in NEOS ? Should I always create custom node type for my object ? Because I have not found any documentation about custom domain entities…

Thanks !

If you need custom doctrine entities refer to the flow documentation (the framework underneath)

https://flowframework.readthedocs.io/en/8.3/TheDefinitiveGuide/PartII/ModelAndRepository.html

I don’t know if I need doctrine entities. I need to place vocation entities to main page. And each vocation should refer to separate page with its details. So what is good way for it ? Use node types?
Because not good idea when I place 50 node types for vocations on main page. And then I have to create 50 extra pages and populate them with content for each vocation… I would like to create vocations on back-end (set title, image, description etc) and then display them on front-end… And also have some page to display details for any vocation when customer visit it from main page…

Thanks a lot for any clarification because for me now not clear what is good way for this on NEOS…

Have you ever faced with similar task ? Could you advice something please ?
I hope there is good documentation about this because it is typical task… The node types is clear for me but I think they don’t suit in this case…

In many cases domain-entities can be modeled as nodetype just fine and this is definitely the easiest approach.

There are some drawbacks of nodetypes if you need very special logic or the dimensions of your content do not suit your models but those can often be overcome.

If NodeTypes do not work you can use the domain models of the flow framework (the foundation of Neos) which is documented here. Flow dev-master Documentation — Flow Framework dev-master documentation. There is quite a bit to learn so i recommend to really check out NodeTypes first.

2 Likes

Sorry for my short answer at the top ^^

I once had a similar usecase, where i had a lot of nodes, which where very simple (a few props + image) and i wanted to display them in a gallery (or some place all at once)

So i used document nodes under a certain parent node and created these nodes, it got harder to manage these individual document nodes, so i quickly hacked a backend module together which could display these documentNodes with their props all in one list so one could edit them more efficently.

But the core idea is, to have only one place where your “vocation” relies (the documentNode) and instead of creating manually vocation preview items (at the place where you want to show all vocations), you will just find all vocations ${q(site).find("[instanceof Your:Vocation]").get()} and display them (you can have special props on the documentNode, which are only used for this case fx.)

Thanks a lot for your explanation! But I still can’t understand how can I solve my problem with Node Types.

The goal:

  • create 50 vocations objects
  • display them on main page
  • implement possibility to go inside each vocation and see details on separated page.

If I understand correctly, with Node Types I have to put 50 times Node Type vocation on main page. Then I have to create 50 pages for each vocation and connect each page with specific vocation from main page. Then I can click on link on any vocation on main page and go to details separated page for each vocation. And also I have to fill each of 50 pages with information about each vocation (maybe I have to use another Node Type “Vocation detail”)

Looks really not handy. Or maybe I don’t know how to optimize and make it better with Node Types ?

I would like to fill only one time the the vocation properties and not to create 50 pages, but have one page where details of vocation will be displayed, depending on which vocation passed in url.

I hope my problem is clear, but is it possible to achieve with node types and how ?

In Neos things you want to link to are usually created as documentNodeTypes. So you would create a type Vendor.Site:Vocation that extends Neos.Neos:Document.

That allows you to create the detail pages and define all the needed properties there.

For the Startpage you would create a content Nodetype VocationList that finds all Vocations and renders teasers and links.

Other Cms edit from the list but editing from the detail page makes much more sense once you get the hang of it.

1 Like

Ok now I got more imagination from your answer. But how can I find all vocations and render links ? And moreover where should I place vocations first ? Because before find all vocations I have to create them first… And on my opinion all node types we can put only on the page.

And by this way should I still create a lot pages for each Vocation, or I need only one page ?

A nodetype can be a page (Neos.Neos:Document) or content (Neos.Neos:Content). If you have something that later can be reached by a url, use the document.

You can create content elements that query all those documents and show teasers for each f.e.
Like most blogs and listing plugins do.

1 Like