conditional-statementsnelmio-alice

Condition (if, else, else if) in YAML


I use hautelook/AliceBundle to create faker data in YAML, but I would for more consistency of data.

I would like that:

gender: <randomElement(['Homme', 'Femme'])>
if $gender == 'Homme'
    title: 'Monsieur'
else if $gender == 'Femme'
    title: 'Madame'

I know it's not directly possible in YAML, but I do not know which plugin to use... And how to.

My tools/languages used in my project (Symfony, hautelook/AliceBundle, PHP, YAML)


Solution

  • You cannot do that. YAML is data serialization language, not a programming language.