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

ContentUn/PublishTaskHandler requires entityRepository to implement ObjectRepository #192

Open
Prokyonn opened this issue Jul 19, 2021 · 2 comments
Labels
DX Only affecting the end developer

Comments

@Prokyonn
Copy link
Member

Problem:

The ContentPublishTaskHandler and the ContentUnpublishTaskHandler get the entityRepository via the entityManager with $repository = $this->entityManager->getRepository($class);.

In the doctrine/DotrineBundle the method ContainerRepositoryFactory::getOrCreateRepository(..), which is used by the EntityManager::getRepository(..) method, is type hinted for versions newer than 2.0.6 with the return type ObjectRepository.

Thus means, for the ContentTaskHandler to work properly, the entityRepository must implement the ObjectRepository interface.

Possible solution:

Instead of getting the repository via the entityManager, just use entityManager->find($class, $id).

@niklasnatter
Copy link
Contributor

Would implement this similar to the ContentReindexProvider/ContentTeaserProvider/ContentObjectProvider/...:

$this->entityManager->createQueryBuilder()->from($this->contentRichEntityClass, 'contentRichEntity')

@alexander-schranz alexander-schranz added the DX Only affecting the end developer label Sep 15, 2021
@alexander-schranz
Copy link
Member

Want to mention that ContentReindexProvider/ContentTeaserProvider/ContentObjectProvider are currently violeting the #196.

There already exist the DimensionRepository which should be used for all admin processes. The DimensionRepositoryInterface should be adjusted to get just the class and the id of the element (more is currently not needed):

    public function load(
        string $contentRichEntityClass,
        string|int $identifier,
        array $dimensionAttributes
    ): DimensionContentCollectionInterface {

public function load(
ContentRichEntityInterface $contentRichEntity,
array $dimensionAttributes
): DimensionContentCollectionInterface {

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

3 participants