- πͺπΈ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 7:03am 2 November 2023 - πͺπΈ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
andisPublished()
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!
-
e0ipso β
committed 9e13c111 on 2.x authored by
plopesc β
Issue #3101435 by nitesh624, Ahmed_Samir: Only warm published entities
-
e0ipso β
committed 9e13c111 on 2.x authored by
plopesc β
- Status changed to Fixed
over 1 year ago 10:04am 6 November 2023 -
e0ipso β
committed c007dcc6 on 2.x authored by
nitesh624 β
Issue #3101435 by plopesc, nitesh624, e0ipso, Ahmed_Samir: Only warm...
-
e0ipso β
committed c007dcc6 on 2.x authored by
nitesh624 β
- e0ipso Can Picafort
Added an empty commit to include more issue credit. Apologies.
Automatically closed - issue fixed for 2 weeks with no activity.