Skip to content

Instantly share code, notes, and snippets.

@pounard
Created April 21, 2015 12:35
Show Gist options
  • Save pounard/955b5372724927bc85e3 to your computer and use it in GitHub Desktop.
Save pounard/955b5372724927bc85e3 to your computer and use it in GitHub Desktop.
$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