sulu / SuluContentBundle

Add content behaviours to a Doctrine Entity
14 stars 19 forks source link

Created, Changed, Creator and Changer not available in Structure #225

Open alexander-schranz opened 2 years ago

alexander-schranz commented 2 years ago

Currently the structure does not return created, changed, creator and changer. I personally not even sure if we want it. As the only thing which should be displayed on a Website is authored and author. All other things should be not used to display as the Content Manager can not change it. But in some cases a lastChanged can make sense example in the Sitemap or on a Blog display when it is updated. The other 3 fields I would even like to avoid to be available in Twig to avoid false usage as it that fields are more for the Admin instead of the Website aslong as you are not creating a Wiki like website application.

vntw commented 1 year ago

Since it's labelled "To Discuss": I ran into this today, having author/authored available would be very helpful, especially for sth. like articles/posts which I'm sure a lot of people will use in the future.

I'm currently getting that data via a twig function from the current content object to render where it's needed, didn't find a better option (with my limited Sulu, let alone ContentBundle knowledge).

alexander-schranz commented 1 year ago

@vntw if I remeber correctly if your entity implements AuthorInterface the author and authored should be available when using 0.x@dev version: https://github.com/sulu/SuluContentBundle/blob/b5c3eeb2e6875437b81febcd8583e9c1400aacaf/Tests/Application/ExampleTestBundle/Entity/ExampleDimensionContent.php#L39-L41.

Author was implemented here: https://github.com/sulu/SuluContentBundle/pull/193

vntw commented 1 year ago

Thanks for the hint, I don't want to misuse this issue for my "issue" but I used exactly that example application as a starting base since there's not much documentation available, so the AuthorInterface is already implemented (using the latest commit in 0.x b5c3eeb2e6875437b81febcd8583e9c1400aacaf) but I don't see any author related data in the twig output (except the request object attribute of the entity). Would I expect it in the content array or in the root level?

While debugging I found https://github.com/sulu/sulu/blob/097a23c376f1fddbcdfdbd4f564f7847ec0cc934/src/Sulu/Bundle/WebsiteBundle/Resolver/StructureResolver.php#L110 which seems to be sth. different since the method signatures are different and the check is against ContentDocument, not the custom DimensionContent entity