Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
entity system
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Dec 2014 at 12:59 UTC
Updated:
11 Jan 2015 at 14:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
alexpottComment #2
alexpottPatch attached adds a event subscriber to check any delete of config entities that are bundles. If they are in use it prevent config import.
Comment #3
yched commentedDon't we have a hadData() method for that already ?
Side note : that is a bit verbose :-)
Accessing the list of changes is likely to be the primary task for any event class reacting to "config import". Could ConfigImporterEvent provide a helper ->getChangeList($op) method to simplify that ?
Makes sense for a "config import" event to provide direct access to the list of changes in the import ?
Comment #4
alexpottRe #3
Comment #5
fagoPatch looks great, only found some nitpicks:
Minor but it are $ids, not $entities.
they are used?
Comment #6
yched commented#3.1 - ah, true, the existing one is not by bundle :-/
That could be easily added without an API break, though ?
#3.2 - awesome :-)
Yay, I hesitated to suggest that change earlier on.
s/Is/Does, though :-)
Comment #7
alexpott@fago thanks for the review
Comment #8
fagoLooks like entities was wrongly replaced in the message with entity_ids.
Comment #10
alexpottalexpott--
Comment #11
yched commentedTypo in #6 still needs adressing :-)
Other than that, looks RTBC ?
Comment #12
swentel commentedMaybe 'There are existing entities of type .. ' instead of existing at the end ? Sounds better in my mind.
Comment #13
alexpottAddressed #12 and #6. Thanks for all the reviews.
Comment #14
swentel commentedLooks great.
Comment #15
wim leersBeautiful patch: beautiful code & beautiful test.
Two nits that could be fixed on commit:
Nit: "list of differences" vs. "changelist".
Nit: Needs fully qualified classname.
Comment #16
webchickActually, I think I'd love to see that test hardened a little bit, if possible. It was actually not obvious except from having swentel walk me through it why the presence or absence of the string "There are no configuration changes to import." meant things were working. And from looking at other tests in that file, most of them both assertText on the UI but also assertFoo to make sure things are working properly under the hood as well.
In other words:
Apart from that, and the things Wim mentioned, this looks good to go.
Comment #17
swentel commentedI'm quickly updating the test
Comment #18
swentel commentedMore asserts. Also address the first from Wim's review. Couldn't come up with something for 2 though ..
Comment #19
swentel commentedGave the assert on '5 removed' another thought and removed it. It's kind of silly to be looking for this number, especially if at some point we change something in the generation of fields, displays etc. Having to change the number is not worth asserting for.
Comment #20
wim leersComment #21
catchExtreme nitpick but why 'differences' and not just 'changes'?
Sorry don't love the assignment here - can we just move that to the line above too?
This seems like something we'd probably want to re-use elsewhere too?
Comment #22
yched commented@catch:
Made that same remark in #3 / #6. ContentEntityStorage::hasData() should have an optional $bundle param.
But IMO it would be better to do as part of or after #2391829: ContentUninstallValidator relies on the not required ContentEntityStorage::hasData() method (left a note in comment #12 over there), keeping the manual implementation here for now.
Comment #23
alexpottre #21
Comment #24
alexpottSetting to rtbc since the changes in #23 are so minor
Comment #26
alexpottrandom unrelated fail.
Comment #29
catchAvoiding the duplication of code in the other issue seems fine.
Committed/pushed to 8.0.x, thanks!