- πΊπΈUnited States danflanagan8 St. Louis, US
My mind was just blown. I was thinking about this again, this time thinking that I'd have a SuperGet class that would override Get. Then I saw that Get can already be coaxed into referencing the current value of the pipeline. From its transform method:
foreach ($properties as $property) { if ($property || (string) $property === '0') { $return[] = $row->get($property); } else { $return[] = $value; } }
That "else" case puts the current pipeline value into $return. When does that case run? When
$property
isnull
an empty string or an empty array. Those are essentially keywords that do the thing I was introducing with%pipeline
So we already can do this! The snippet from the IS would be:process: processed_value: - plugin: callable source: field_product callable: ucfirst - plugin: concat source: - 'constants/i' - null
It's weird and not intuitive and hard to read, but it totally works!!!