Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
configuration system
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
22 Oct 2014 at 11:03 UTC
Updated:
3 Jun 2015 at 13:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
alexpottPostponing on #2282519: Add content dependency information to configuration entities
Comment #2
alexpottWe can do this now...
Comment #3
xjmComment #4
larowlanworking on this
Comment #5
alexpottHere's some work I already had done on this - needs tests though.
Comment #6
alexpottComment #7
larowlanHere's what I have, the test fails and I'm not sure how to test the context handling (batch).
Comment #8
larowlanso yours is way better than mine ;)
Comment #9
larowlanOne thing mine does is make ConfigImporter::getProcessedConfigurations useful, making it contain the config objects instead of the keys. We have no calls to that method in core (tests or otherwise) so that's most likely why - at present I think it doesn't really help anyone who listens to a ConfigImporterEvent.
Comment #10
dawehner@larowlan
I don't get why you reimplemented the feature in a different way. The advantage of the proposal of alexpott is that
you can recursivly resolve content dependencies, which is kind of helpful for entity references and what not.
nice one :)
It seems a bit odd to use FALSE and not just NULL
Does this really has to be a batch context? Is the system really built in a way to rely on something like a batch process? It would be really helpful to describe what is part of the
$context, currently you as a user would have no clue what is in here.You don't test 'hi_there' at the moment.
Comment #11
larowlanSorry - should have said that @alexpott and I spoke on irc and realised we were both working on it at the same time - so we decided to put our patches up and then join forces and iterate from there.
I think @alexpott's is better too - but I like the changes to getProcessedConfigurations in mine, but no reason that can't go in a new issue
larowlan-- no idea what happened there but tipping wrong window was open :)
Comment #12
alexpott@larowlan the issue with getProcessedConfigurations() actually keeping a reference to the config means that all config is loaded on all steps of the batch - and possibly could go stale if there are side effects.
Comment #13
larowlanAh, so maybe we just need more documentation of how to get the objects from the event subscriber
Comment #17
isntall commentedPatch from comment 7, 2361423-content-config-sync.5.patch, does not seem to pass the testbot checks, and it doesn't seem to fail properly either. Please reroll.
Comment #18
alexpottThe patch from #5 rerolled. @isntall core generally is self-service :) see http://drupal.org/patch/reroll
Comment #19
dawehnerOh nice, you can already add your own steps in contrib
What about using "FinalMissingContentSubscriber" as name?
... mh, so 1024 is a pretty high priority, I think you wanted to use -1024
Wrong variable name, probably.
From an API point of view, I think its wrong to stop always after the first resolveMissingContent call. Doesn't stopPropagation much more belongs into EventSubscriber?
Comment #20
yched commentedSame remarks as @dawehner :
- EventSubscriber is a bit short / non-telling
- seems surprising to stop propagation on the first entity being resolved ?
Nitpick : the whole method could be a bit leaner if it started by extracting the piece of the $context it's going to use for its processing, like
$sandbox = &$context['sandbox']['config'];instead of fully dereferencing it again and again ?
Comment #21
dawehner.
Comment #22
larowlanfixes #19 and #20 plus a re-roll
Comment #23
swentel commentedrerolled
Comment #24
dixon_Let's replace
()with a.here :)The docs seems wrong here since we no longer stop propagation here.
Agreed, I don't think we need to do anything here. So let's remove the
elseblock here?Comment #27
alexpottPatches addresses everything in #24 and adds a test implementation of an event listener and uses it to test :)
Comment #28
jibranIf we are passing all the missing content in one go why would we need a sandbox? Are we missing some kind of array_slice here?
I think we can but it has to be a different loop. We can create an array of uuids per entity_type and then load it in next loop using loadByProperties() or see
EntityReferenceFieldItemList::processDefaultValue()for similar kind of implementation.Comment #29
alexpottre #28
Comment #30
dixon_Code looks good. I'll be working on a proof-of-concept implementation in Deploy this week at DrupalCon that utilizes this.
Marking this as RTBC, with a very minor documentation fix to the patch (please don't give me commit credit because I haven't really worked on the patch itself).
Comment #31
dixon_Comment #33
alexpottUnrelated fail in Drupal\locale\Tests\LocaleJavascriptTranslationTest.
Comment #35
alexpottComment #36
catchIt's not clear from me what happens if there's no subscriber to deal with the missing content? Could this get stuck?
Oh here it is!
However I didn't immediately see test coverage that covers this case (i.e. that the final subscriber successfully removes content depenencies when nothing else has) - or did I miss it?
Comment #37
alexpott@catch well there is implicit coverage in things like ConfigImportAllTest but I've added explicit coverage in the attached patch.
Comment #38
catchThat looks better. Committed/pushed to 8.0.x, thanks!