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

joshi.rohit100 created an issue.

ndeet’s picture

Hi, 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

joshi.rohit100’s picture

@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)

heddn’s picture

I 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?

joachim’s picture

We 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.