Postponed
Project:
Migrate Plus
Version:
6.0.x-dev
Component:
Plugins
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
19 Jan 2018 at 17:16 UTC
Updated:
25 Feb 2025 at 11:02 UTC
Jump to comment: Most recent
There's no point in having this in entity_lookup AFAICT.
If you're detecting the entity type and bundle from the field, then you ask the entity type manager service for the bundle key:
$this->lookupBundleKey = $this->lookupBundleKey ?: $this->entityManager->getDefinition($this->lookupEntityType)->getKey('bundle');
But if the developer specifies the entity type and bundle in the configuration, the bundle key can ALSO be obtained from the entity type manager! There is no other value the bundle key can be, it's entirely determined by the entity type.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
joachim commented(Don't remove lookupValueKey though -- that's really useful for looking up entities by another field than their title!)
Comment #3
marvil07 commentedComment #5
joachim commentedComment #6
matroskeenIt looks good to me, and I would be happy to commit this change after we land #2787219: Entity lookup plugin not able to guess config for entity types without bundle, which introduces more test coverage for the plugin. I'll mark it as Postponed for now.
Comment #7
mpp commentedAtm the bundle_key is marked optional but when not passing it, under certain circumstances, the lookup isn't filtered for the proper bundle.
The following will result in a lookup on all bundles (not just the article):
I had to explicitly add
bundle_key: typeto fix it.Comment #8
thtas commentedYes this can create some nasty bugs.
We ended up associating terms from the wrong vocabulary because the documentation isn't clear that you both bundle AND bundle_key are required, it just says:
This implies that both are optional and makes no mention that `bundle` is useless without `bundle_key`.
Comment #9
ressaI also saw this, where I was using a most basic set up of only entity_generate (same configuration as entity_lookup) based on the doc page Contrib process plugin: entity_generate (since updated), but had to supply a lot more configuration to make it work, as in comment #7. See #2787219-30: Entity lookup plugin not able to guess config for entity types without bundle.