Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
There are situations (I have currently one) where user need to find the entity based on multiple field values but entity_lookup only supports one value. I think it would be great if entity_lookup supports array for value_key property.
Comments
Comment #2
ndeet CreditAttribution: ndeet at Zensations commentedHi, do you have an example for this. I currently have some migrations where multiple term references are looked up and provided as array which work just fine with 8.x-3.x-beta1/dev
Comment #3
joshi.rohit100@ndeet - Here is use case - I have 2 CTs A and B. A has a node reference field which refers ct B. We don't have separate migration of B as it is part of A. B has 2 fields. So while migrating A, I need to check (lookup) for B if already exists or not but I want to looked up for both field value (uniqueu) not just nid (For B)
Comment #4
heddnI don't think we can lookup on more than a single value. If you need to support multiple, extend the base class and add in your additional logic. Is that a viable solution?
Comment #5
joachim CreditAttribution: joachim as a volunteer commentedWe could split this class into an explicit 'entity lookup by label' and a more general entity query plugin, which could take an array of keys and values.