|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AppBundle\DataFixtures\ORM; |
|
4
|
|
|
|
|
5
|
|
|
use AppBundle\Entity\Meal; |
|
6
|
|
|
use AppBundle\Price\Price; |
|
7
|
|
|
use Doctrine\Common\Persistence\ObjectManager; |
|
8
|
|
|
|
|
9
|
|
|
class LoadMealData extends Fixture |
|
10
|
|
|
{ |
|
11
|
|
|
/** |
|
12
|
|
|
* {@inheritdoc} |
|
13
|
|
|
*/ |
|
14
|
|
|
public function load(ObjectManager $manager) |
|
15
|
|
|
{ |
|
16
|
|
|
$data = array( |
|
17
|
|
|
'Apéritif' => array( |
|
18
|
|
|
'10 Petits croissants au saumon' => '4.00', |
|
19
|
|
|
'6 Beignets de morue' => '3.00', |
|
20
|
|
|
'6 Rissoes à la viande ou aux crevettes' => '3.00', |
|
21
|
|
|
'20 Roulés saucisses ou divers petits fours' => '3.00', |
|
22
|
|
|
'Cake jambon/olives ou saumon ou thon' => '4.00', |
|
23
|
|
|
'10 Navettes garnies ( jambon, fromage, paté etc...)' => '3.00', |
|
24
|
|
|
), |
|
25
|
|
|
'Entrée' => array( |
|
26
|
|
|
'Coquille Saint Jacques' => '3.50', |
|
27
|
|
|
'Coquille aux fruits de mer' => '2.40', |
|
28
|
|
|
'Quiche lorraine (6 parts)' => '3.50', |
|
29
|
|
|
'Quiche saumon-brocolis ou saumon-poireaux' => '4.50', |
|
30
|
|
|
), |
|
31
|
|
|
'Sur le pouce' => array( |
|
32
|
|
|
'Ficelle Picarde' => '2.50', |
|
33
|
|
|
'Croque Madame' => '1.50', |
|
34
|
|
|
'Couronne de jambon, fromage (6 parts)' => '7.50', |
|
35
|
|
|
'Crêpe au sarazin garnie' => '2.50', |
|
36
|
|
|
'Hamburger' => '2.50', |
|
37
|
|
|
'Pizza' => '5.00', |
|
38
|
|
|
), |
|
39
|
|
|
'Pâtes' => array( |
|
40
|
|
|
'6 Cannellonis chêvre, épinards' => '4.50', |
|
41
|
|
|
'Spaguettis bolognaise' => '4.50', |
|
42
|
|
|
'Lasagnes viande tomate ou saumon épinards' => '4.50', |
|
43
|
|
|
'Tagliatelles carbonara' => '4.50', |
|
44
|
|
|
'Pâtes à la Rosa' => '4.50', |
|
45
|
|
|
'Pennes aux 4 fromages' => '4.50', |
|
46
|
|
|
'Tagliatelles au saumon' => '4.50', |
|
47
|
|
|
'Pâtes aux fruits de mer' => '4.50', |
|
48
|
|
|
), |
|
49
|
|
|
'Plats' => array( |
|
50
|
|
|
'Hachis parmentier' => '5.00', |
|
51
|
|
|
'Endives au gratin (jambon, pommes de terre)' => '5.00', |
|
52
|
|
|
'Tartiflette' => '5.00', |
|
53
|
|
|
'Morue à la crème, pomme de terre, épinards ou pas' => '5.00', |
|
54
|
|
|
'Rata aux poireaux, pomme de terre, sauté de porc' => '5.00', |
|
55
|
|
|
'Escalope de porc panée avec riz et légumes' => '5.00', |
|
56
|
|
|
'Rouelle avec pomme de terre au four' => '5.00', |
|
57
|
|
|
'Brandade de morue parmentière' => '5.00', |
|
58
|
|
|
'Fricassée de volaille à l\'ancienne, riz pilaf' => '5.00', |
|
59
|
|
|
'Pomme de terre macaire (jambon-fromage)' => '5.00', |
|
60
|
|
|
'Gratin dauphinois au jambon' => '5.00', |
|
61
|
|
|
'Risotto aux fruits de mer' => '5.00', |
|
62
|
|
|
'Risotto poulet, champignons' => '5.00', |
|
63
|
|
|
'Chou rouge cuit avec pomme et saucisse' => '5.00', |
|
64
|
|
|
'Tomate farçie en sauce, riz ou pâtes au choix' => '6.00', |
|
65
|
|
|
'Courgette farcie garniture au choix' => '6.00', |
|
66
|
|
|
'Paêlla' => '7.00', |
|
67
|
|
|
'Bœuf bourguignon avec pâtes ou purée' => '7.00', |
|
68
|
|
|
'Bœuf strogonof (tomate crème moutarde), garniture au choix' => '7.00', |
|
69
|
|
|
'Carbonnade flamande avec garniture' => '7.00', |
|
70
|
|
|
'Langue de bœuf, pomme de terre, légumes, sauce' => '7.00', |
|
71
|
|
|
'Roti de porc Orloff, garniture au choix' => '7.00', |
|
72
|
|
|
'Filet mignon, pomme de terre, endive, sauce maroille' => '7.00', |
|
73
|
|
|
'Choucroute viande ou poisson, pommes vapeur' => '7.00', |
|
74
|
|
|
'Parmentier de canard' => '8.00', |
|
75
|
|
|
'Veau marengo, garniture au choix' => '8.00', |
|
76
|
|
|
'Couscous 3 viandes(mouton ou bœuf, poulet, merguez)' => '8.00', |
|
77
|
|
|
'Cassoulet au canard' => '8.00', |
|
78
|
|
|
'Tripes à la portugaise avec du riz' => '8.00', |
|
79
|
|
|
'Blanquette de veau à l\'ancienne, garniture au choix' => '8.00', |
|
80
|
|
|
'Poulpe mijoté aux légumes, pomme de terre' => '8.00', |
|
81
|
|
|
), |
|
82
|
|
|
'Desserts' => array( |
|
83
|
|
|
'Pudding portugais (8 parts)' => '6.00', |
|
84
|
|
|
'6 pasteis de natas' => '4.00', |
|
85
|
|
|
'Tarte aux fruits (6 personnes)' => '4.00', |
|
86
|
|
|
), |
|
87
|
|
|
); |
|
88
|
|
|
|
|
89
|
|
|
foreach ($data as $categoryName => $meals) { |
|
90
|
|
|
$category = $this->get('doctrine')->getRepository('AppBundle:Category')->findOneByName($categoryName); |
|
91
|
|
|
if (!$category) { |
|
92
|
|
|
throw new \InvalidArgumentException(sprintf('Found no category with name "%s".', $categoryName)); |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
$position = 0; |
|
96
|
|
|
foreach ($meals as $name => $mealData) { |
|
97
|
|
|
$position++; |
|
98
|
|
|
|
|
99
|
|
|
if (is_string($mealData)) { |
|
100
|
|
|
$mealData = array('price' => $mealData); |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
$mealData = array_merge(array( |
|
104
|
|
|
'description' => null, |
|
105
|
|
|
), $mealData); |
|
106
|
|
|
|
|
107
|
|
|
$meal = new Meal(); |
|
108
|
|
|
$meal |
|
109
|
|
|
->setName($name) |
|
110
|
|
|
->setCategory($category) |
|
111
|
|
|
->setDescription($mealData['description']) |
|
112
|
|
|
->setPrice(new Price($mealData['price'])) |
|
113
|
|
|
->setPosition($position) |
|
114
|
|
|
; |
|
115
|
|
|
|
|
116
|
|
|
if (isset($mealData['active'])) { |
|
117
|
|
|
$meal->setActive($mealData['active']); |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
$manager->persist($meal); |
|
121
|
|
|
} |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
$manager->flush(); |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* {@inheritdoc} |
|
129
|
|
|
*/ |
|
130
|
|
|
public function getOrder() |
|
131
|
|
|
{ |
|
132
|
|
|
return 2; |
|
133
|
|
|
} |
|
134
|
|
|
} |
|
135
|
|
|
|