Created
April 21, 2015 12:35
-
-
Save pounard/955b5372724927bc85e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$mockList = [ | |
[ | |
'name' => "Sa maman", | |
'firstname' => 'Josianne', | |
'lastname' => 'Balasko', | |
], | |
[ | |
'name' => "Des ours", | |
'firstname' => 'Jean', | |
'lastname' => 'Rochefort', | |
], | |
]; | |
$manager = $this->getManager(); | |
foreach ($mockList as $data) { | |
$survey = new Survey(); | |
$survey->setName($data['name']); | |
$survey->setAuthorFirstname($data['firstname']); | |
$survey->setAuthorLastname($data['lastname']); | |
$survey->setAuthorEmail($data['firstname'] . $data['lastname'] . '@makina-corpus.com'); | |
$manager->persist($survey); | |
foreach ([ | |
"Et vous ?" => [ | |
"Bien", | |
"Ou bien ?", | |
"Et toi ?", | |
], | |
"Mais comment donc Houston!" => [ | |
"Pif", | |
"Paf", | |
"Pouf", | |
], | |
"De quelle couleur?" => [ | |
"Canette", | |
"Armoire", | |
"Giraffe", | |
], | |
"Pourquoi?" => [ | |
"Touche à ton cul", | |
"Sens ton doigt", | |
"Deux fois", | |
], | |
] as $sentence => $choices) { | |
$manager->persist( | |
(new Question($survey)) | |
->setSentence($sentence) | |
->setFirstChoice($choices[0]) | |
->setSecondChoice($choices[1]) | |
->setThirdChoice($choices[2]) | |
); | |
} | |
} | |
$manager->flush(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment