Open bjarnef opened 7 months ago
Hi there @bjarnef!
Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.
We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.
We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.
Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:
I think the UI ideally show handle this:
Document Type: Only document type is allowed to be created a child content type (otherwise the ModelsBuilder generation fails for child element type, because it expect parent to be element type.
Element Type: Only element type is allowed to be created a child content type (otherwise the child document type will inherit from parent element type and implement IPublishedElement
instead of IPublishedContent
, which mean existing content created for that document type is newly created content based on that document type will throw an error.
I noticed when moving the document type to root, it seems to have a reference to the "old" parent as a composition instead and it is allowed to use both document type and element type as composition on a document type.
Hey @bjarnef 👋
Thanks for reaching out! To make sure I understood you correctly, can you please see if I am not missing any steps in the video below, as I am not getting the error when visiting the content node I created with one of the nested content types. In my case, the node named "Component" is a folder and the Models builder mode is "SourceCodeManual"
🙂
https://github.com/umbraco/Umbraco-CMS/assets/21998037/1476848b-7411-4e12-a483-4f4f38a70410
Hi @elit0451
The "Component" is not a folder / entity container - its a content type :)
This is a project migrated from v8 -> v10 -> v12 -> v13 ... but I think it was on v7 or previous v8 before folders were implemented.
The "Component" was a document type, while most children was element types - except "Emergency" which was a document type.
With this ModelsBuilder generation fails, because the child element types inherits from "Component", but it expect parent to inherit IPublishedElement
.
Changing the "Component" document type to element type instead fix the models generation.
However if an existing node has been created of type "Emergency" or creating a new one of this type, it will throw an error, because "Emergy" now inherits from IPublishedElement
, but it expect to implement IPublishedContent
.
I solved this by moving "Emergency" document type to root instead by updating parentId
and path
in umbracoNode
table.
I see, here is a video of how I managed to reproduce the error:
https://github.com/umbraco/Umbraco-CMS/assets/21998037/1e978e20-da42-4094-8fcf-faf2e85258d5
I will talk to the team about how we want to approach this and will get back to you on Monday 💪
@elit0451 if you now disable element type on "Root" content type (so it's a document type), then accessing the node won't show the error, but generation of ModelsBuilder models fail, because of the other nested content type (element type), which expect the parent content type "Root" to be an element type.
Great insights 🙌
Hey again @bjarnef, and thanks for being patient with my reply 🙌 (busy days 🙈)
I will hopefully be able to provide some feedback for you tomorrow 🤞
So, here it is:
Thanks again for pointing this out!
Hi @bjarnef,
We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.
For more information about issues and states, have a look at this blog post.
Thanks muchly, from your friendly Umbraco GitHub bot :-)
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
13.0.3
Bug summary
I noticed in a migrated project from Umbraco v8 -> v10 -> v12 -> v13, which didn't use ModelsBuilder before, it caused some issues.
The "Component" here was a document types and most children element types.
ModelsBuilder couldn't generate models for these as the parent "Component" was a document type, switching this to an element type fixed models generation.
However it causes other issues as "Emergency" is used as content node, so accessing this caused the following error, because it no longer implements
IPublishedContent
because it inherits "Component" whichs is anIPublishedElement
:Maye there should be an event, so it parent document type is changed to element type, it updates children/descendant content types to element type as well?
But in this case "Is an Element Type" is locked on "Emergency" content type - probably because it is already used as a node.
Often if would also be nice to move nested content types out of inheritance from UI. https://github.com/umbraco/Umbraco-CMS/discussions/15605
Specifics
No response
Steps to reproduce
IPublishedContent
toIPublishedElement
Expected result / actual result
No response