Skip to content

Transforming specific columns in any table #1229

@cdaguerre

Description

@cdaguerre

Hi! I'm trying to transform specific columns of a table:

Given there are following flights available:
  | from_airport | to_airport  | from_date | to_date   |
  | CDG          | JFK         | +93 days  | +98 days  |
  | CDG          | JFK         | +93 days  | +98 days  |

To my understanding, its is possible to transform an entire table, but it is not possible to create a transformer for a specific column name, correct?
I understand that transformers should be called on each "cell" of the table, and the following should work:

Given there are following flights available:
  | from_airport | to_airport  | from_date | to_date   |
  | airport CDG  | airport JFK | +93 days  | +98 days  |
  | airport CDG  | airport JFK | +93 days  | +98 days  |

With this Transformer:

/**
 * @Transform airport :airport
 * @Transform /^airport ([A-Z]{3})$/
 */
public function transform(string $iataCode): AirportInterface
{
    // do stuff
}

But it doesnt work. Any help would be much appreciated!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions