The Needs Review Queue Bot β tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide β to find step-by-step guides for working with issues.
- First commit to issue fork.
- last update
over 1 year ago 30,342 pass - πΊπΈUnited States pmagunia Philadelphia πΊπΈ
Adding a file patch in case anyone want to link. Identical to #38
- Status changed to Needs review
over 1 year ago 2:54pm 30 August 2023 - last update
over 1 year ago 30,099 pass - πΊπΈUnited States pmagunia Philadelphia πΊπΈ
If someone wanted to use the code in the patch:
function MYMODULE_update_10000(&$sandbox) { \Drupal::service('entity_field.manager')->rebuildBundleFieldMap(); }
- Status changed to Needs work
over 1 year ago 6:35pm 6 September 2023 - πΊπΈUnited States smustgrave
Seems to be an open question in #34 could that be answered?
- π¬π§United Kingdom joachim
> Should I assert against an explicit expected bundle field map, or just test that it's the same before and after a rebuild. Normally I like to be really explicit in tests, but in this case I thought that would introduce additional brittleness, so I just test it's the same before and after.
I think testing it's the same before and after is potentially good, in that as you say it keeps the test simple.
And I see that the test is deleting the map -- so the intention is that we're checking that the rebuild actually can rebuild from scratch. However, we're not checking that after the deletion the map is empty!
> How complex a bundle field map should I be making for the test? I've kept it simple for the time being.
What are the different cases we should consider?
- π¬π§United Kingdom joachim
Also,
> public function rebuildBundleFieldMap() {
The other methods that work with the field map call it just 'field map', so the use of 'bundle' in this method name is confusing.
- π¬π§United Kingdom joachim
rebuildBundleFieldMap() should finish off by clearing the 'entity_field_map cache item, as otherwise it won't have any apparent effect.
- πΊπΈUnited States m.stenta
Separate thought but: perhaps this can be leveraged to help with #3045509: EntityFieldManager::getFieldMap() doesn't show bundle fields β ?
- First commit to issue fork.
- Merge request !8811Issue #3129179: Provide some way to rebuild the persistent bundle field map β (Open) created by paul121
- πΊπΈUnited States paul121 Spokane, WA
I've opened a new MR against 11.x. Chose to cherry-pick the existing commits into a new MR because there were unrelated merge conflicts in the core branches between 9.3.x and 11.x. and I didn't want to force-push this old branch. Attaching a patch file for composer builds.
rebuildBundleFieldMap() should finish off by clearing the 'entity_field_map cache item, as otherwise it won't have any apparent effect.
I've added a final step to clear this cache item and updated tests to account for this. One thing I noticed is that these tests are implemented in a new Kernel test file - all of the existing EntityFieldManager tests seem to be unit tests. I'm not sure if that is a blocker for merging.
- Status changed to Needs review
5 months ago 5:35am 18 July 2024 - Status changed to RTBC
5 months ago 4:37pm 18 July 2024 - π¬π§United Kingdom scott_euser
Thanks for the work on this! Gave it a whirl and seems to be working correctly for me:
- Changes in #45 seem to be addressed + match the way UseCacheBackendTrait does it
- Running
drush php:eval "\Drupal::service('entity_field.manager')->rebuildBundleFieldMap()"
to check works fine
- π³πΏNew Zealand quietone
I left a question in the MR and some suggestions for the comments.
- Status changed to Needs work
8 days ago 9:12pm 10 December 2024 - π¦πΊAustralia nterbogt
I ran this on a site with 31 entities and 1039 fields and it took 1.9 seconds on my local machine. I'm not sure this qualifies it as slow; it's certainly not slow compared to rebuilding node access as an example.