Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename ContentRichEntity to Resource #181

Open
niklasnatter opened this issue Jan 18, 2021 · 3 comments
Open

Rename ContentRichEntity to Resource #181

niklasnatter opened this issue Jan 18, 2021 · 3 comments
Labels
DX Only affecting the end developer

Comments

@niklasnatter
Copy link
Contributor

niklasnatter commented Jan 18, 2021

I would like to propose to rename the ContentRichEntityInterface to ResourceInterface.

I see the following reasons for doing this:

  • Sulu uses the term Resource for an entity that is displayed in the administration interface
  • We already have methods that use the Resource term: DimensionContentInterface::getResourceKey, RoutableInterface::getResourceId
  • Resource is less bulky than ContentRichEntity and would make the bundle code easier to read and easier to talk about
  • Together with Rename DimensionContent to Content #90, this simplifies the core terms/entities/concepts of the bundle and therefore makes it easier to understand for new developers
@alexander-schranz
Copy link
Member

I personally think we should get ride of the ContentRichEntityInterface / ResourceInterface completely. As it should be possible to add Content to every Doctrine Entity, also if it comes from a third party bundle where we are not able to add an Interface our self.

Currently the ContentRIchEntityInterface has the following methods:

  • getId()
  • getDimensionContents()
  • createDimensionContent()
  • addDimensionContent(DimensionContentInterface $dimensionContent)
  • removeDimensionContent(DimensionContentInterface $dimensionContent):

And the DimensionContentInterface reference to it with the following methods:

  • getResource()
  • getResourceKey()
  • getResourceId (RoutableInterface)

So we could replace the exist function:

  • getId() -> getResourceId()
  • getDimensionContents() -> DimensionContentRepository should be used here
  • createDimensionContent() -> DimensionContentInterface::create function given the resource object create(object $resource)
  • addDimensionContent(DimensionContentInterface $dimensionContent) -> not needed if a relation on doctrine exist can be called in create could call the add on the resource
  • removeDimensionContent(DimensionContentInterface $dimensionContent): -> never used or called by us

@niklasnatter
Copy link
Contributor Author

niklasnatter commented Jan 18, 2021

Yes, getting rid of the ContentRichEntityInterface would be even better! But I think its also more work unfortunately 🙂
Do you want to create a separate issue for that?

@alexander-schranz
Copy link
Member

Created a seperate issue for it: #183

@alexander-schranz alexander-schranz added the DX Only affecting the end developer label Jan 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Only affecting the end developer
Projects
None yet
Development

No branches or pull requests

2 participants