As a workaround for #2798641: Index can get created before fields, I tried to add enforced dependencies on my field configs in an index. The idea of those is that re-calculating dependencies doesn't drop them:

dependencies:
config:
- ...
module:
- search_api
- node
enforced:
config:
- ...

This however causes notices because it is assuming that those keys are strings when it shuffles them around:

Illegal offset type Index.php:1541

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir created an issue. See original summary.

drunken monkey’s picture

Status: Active » Needs review
FileSize
1.44 KB

Thanks for reporting this problem!
The attached patch should fix this, quite simply. I don't think we need to include the "enforced" dependencies in the return value of getDependencyData(), since there's no way to do anything about them in onDependencyRemoval() anyways – so we just need to ignore it there, and include it manually in calculateDependencies() (I think).
Please test/review!

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

I haven't tested it, but looking at the code, this should resolve the issue.

  • Nick_vh committed f447680 on 8.x-1.x authored by Berdir
    Issue #2798643 by drunken monkey, Berdir: Enforced dependencies in...
Nick_vh’s picture

Status: Reviewed & tested by the community » Fixed

Thanks. Committed and checked of with Berdir and Borisson_

Status: Fixed » Closed (fixed)

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