Only warm published entities

Created on 16 December 2019, over 5 years ago
Updated 6 November 2023, over 1 year ago

Adding a quick patch to only warm published entities.

✨ Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States Ahmed_Samir

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ͺπŸ‡ΈSpain plopesc Valladolid

    We do have this same need in a client project. Trying to get a working solution.

  • @plopesc opened merge request.
  • Status changed to Needs review over 1 year ago
  • πŸ‡ͺπŸ‡ΈSpain plopesc Valladolid

    Hi!

    Worked on a MR to try to provide the feature to all the entity types that implements EntityPublishedInterface.

    However, we had to check it at query time, so $entity instanceof EntityPublishedInterface or $entity->isPublished() won't work because entities need to be loaded and the aim of this issue is to do not load them.

    Instead, we assumed that entities are implementing EntityPublishedTrait and isPublished() method is not overridden. Following that approach, we can get the entity property that stores the publishing information and add it to the query.

    Checked core entity types that implement the interface above and I think it would work in this way for all of them, but cannot guarantee for other entity types declared by contrib modules. Also reviewed entity types provided by commerce and they respect this pattern.

    What do you think?

    While working on this, also found that as part of D10 migration ->accessCheck(TRUE) was added to the general queue for the entity warmer. This means that not all the entities would warmed, causing possible unexpected results.

    Should we change that line to ->accessCheck(FALSE) by default?
    In that case we could set it back to TRUE if the publised only option is set to TRUE, even if that's not exactly the same.

    Thank you!

  • e0ipso Can Picafort

    Should we change that line to ->accessCheck(FALSE) by default?

    Yes. That was an oversight. Thanks for catching it!

  • Status changed to Fixed over 1 year ago
  • e0ipso Can Picafort

    Merged! Thanks all.

  • e0ipso Can Picafort

    Added an empty commit to include more issue credit. Apologies.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024