|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function actionInitBddDemo($key = '') |
|
|
public function actionInitBddDemo($key = '') |
|
|
{ |
|
|
{ |
|
|
if($key == '45432df6e842ac71aa0b5bb6b9f25d44') |
|
|
|
|
|
|
|
|
if($key == '45432df6e842ac71aa0b5bb6b9f25d44' && YII_ENV == 'demo') |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
$arr_noms = [ |
|
|
|
|
|
'Martin', 'Bernard', 'Thomas','Petit','Robert', 'Richard','Durand','Dubois', |
|
|
|
|
|
'Moreau', 'Laurent', 'Simon', 'Michel', 'Lefebvre', 'Leroy', 'Roux', 'David', |
|
|
|
|
|
'Bertrand', 'Morel', 'Fournier', 'Girard', 'Bonnet', 'Dupont','Lambert', 'Fontaine', |
|
|
|
|
|
'Rousseau', 'Vincent', 'Muller','Lefevre', 'Faure', 'Andre', 'Mercier', 'Blanc', 'Guerin', |
|
|
|
|
|
'Boyer', 'Garnier', 'Chevalier', 'François','Legrand','Gauthier','Garcia','Perrin', |
|
|
|
|
|
'Robin','Clement','Morin','Nicolas','Henry','Roussel','Mathieu','Gautier','Masson', |
|
|
|
|
|
'Marchand','Duval','Denis','Dumont','Marie','Lemaire','Noël','Meyer','Dufour', |
|
|
|
|
|
'Meunier','Brun','Blanchard','Giraud','Joly','Rivière','Lucas','Brunet','Gaillard','Barbier', |
|
|
|
|
|
'Arnaud','Martinez','Gerard','Roche','Renard','Schmitt','Roy','Leroux','Colin','Vidal', |
|
|
|
|
|
'Caron','Picard','Roger','Fabre','Aubert','Lemoine','Renaud','Dumas','Lacroix','Olivier', |
|
|
|
|
|
'Philippe','Bourgeois','Pierre','Benoit','Rey','Leclerc','Payet','Rolland','Lecomte','Lopez', |
|
|
|
|
|
'Jean','Dupuis','Guillot','Hubert','Berger','Carpentier','Sanchez','Dupuis','Moulin', |
|
|
|
|
|
'Louis','Deschamps','Huet','Vasseur','Perez','Trouillot','Fusillier','Massenot','Boucher','Fleury', |
|
|
|
|
|
'Royer','Klein','Jacquet','Jaquin','Adam','Paris','Poirier','Aubry','Guyot','Carré','Charles', |
|
|
|
|
|
'Charpentier','Menard','Bailly','Bertin','Le Gall','Collet','Leger','Bouvier','Millet','Daniel', |
|
|
|
|
|
'Langlois','Pelletier','Perrier','Leblanc','Lebrun','Monnier','Michaud','Laporte','Carlier', |
|
|
|
|
|
'Pasquier','Delaunay','Lamy','Gilbert','Lejeune','Pichon','Cordier','Barthelemy','Perret','Reynaud', |
|
|
|
|
|
'Humbert','Marechal','Bernard','Lemaitre','Gay','Bouchet','Da Silva','Chauvin','Chevalier','Tessier', |
|
|
|
|
|
'Poulain','Girondin','Gillet','Guichard' |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
$arr_prenoms = [ |
|
|
|
|
|
'Adel','Antonin','Armand','Arnaud','Aymeric','Baptiste','Barnabé','Bernard','Brice','Baudouin', |
|
|
|
|
|
'Camille','Cassandre','Célestin','Christian','Clément','Cyril','Claude','Damien','Daniel','David', |
|
|
|
|
|
'Delphin','Denis','Didier','Dimitri','Dorothée','Désiré','Edgard','Etienne','Eugène','Eudes','Eric', |
|
|
|
|
|
'Fabien','Fabrice','Flavien','Florent','Francois','Frédéric','Gabin','Gabriel','Gautier','Gilles','Guy', |
|
|
|
|
|
'Hervé','Huvert','Hugues','Hector','Jacques','Jason','Jean','Jeannot','Johan','Julien','Léon','Lionel','Loïc', |
|
|
|
|
|
'Lucas','Luc','Lucien','Maurice','Maxence','Maxime','Michel','Morgan','Nicolas','Normand','Norbert','Olivier,', |
|
|
|
|
|
'Pascal','Patrice','Pierrick','Raphael','Roland','Stéphane','Sylvain','Sylvestre','Timothée','Thomas','Tristan', |
|
|
|
|
|
'Ulysse','Vincent','Victor','Vivien', |
|
|
|
|
|
'Adeline','Albane','Alix','Amélie','Arielle','Aurelle','Blandine','Blanche','Brigitte','Berthe','Camille','Capucine', |
|
|
|
|
|
'Catherine','Cécile','Charlotte','Chloé','Claudine','Clémenence','Constance','Cyrielle','Corinne','Danielle', |
|
|
|
|
|
'Delphine','Denise','Dominique','Diane','Édith','Éliane','Éléonore','Émilie','Emmanuelle','Ève','Évelyne', |
|
|
|
|
|
'Fanny','Flavie','Flore','Françoise', 'Gabrielle','Gaëlle','Geneviève','Georgette','Germaine','Gertrude','Gisèle', |
|
|
|
|
|
'Gwenaëlle','Hélène','Héloïse','Henriette','Huguette','Inès','Isabelle','Jacqueline','Jeanne','Joëlle','Joséphine', |
|
|
|
|
|
'Juliette','Justine','Julie','Laura','Laure','Léa','Léonie','Lucie','Lucienne','Lorraine','Lucille','Ludivine','Lydie', |
|
|
|
|
|
'Margot','Marion','Marlène','Marthe','Mélodie','Monique','Noémie','Nadine','Nadège','Océane','Odette','Odile','Paulette', |
|
|
|
|
|
'Rose','Roseline','Renée','Sabine','Sophie','Suzanne','Sylvie','Thérèse', |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
$arr_noms_checked = [] ; |
|
|
|
|
|
$arr_prenoms_checked = [] ; |
|
|
|
|
|
|
|
|
|
|
|
$users = User::find() |
|
|
|
|
|
->joinWith('userEtablissement') |
|
|
|
|
|
->where('user_etablissement.id_etablissement = 1') |
|
|
|
|
|
->all() ; |
|
|
|
|
|
|
|
|
|
|
|
foreach($users as $u) |
|
|
|
|
|
{ |
|
|
|
|
|
do { |
|
|
|
|
|
$i_nom = rand(0, count($arr_noms)-1) ; |
|
|
|
|
|
$i_prenom = rand(0, count($arr_prenoms)-1) ; |
|
|
|
|
|
} while(isset($arr_noms_checked[$i_nom]) || isset($arr_prenoms_checked[$i_prenom])) ; |
|
|
|
|
|
|
|
|
|
|
|
$arr_noms_checked[$i_nom] = true ; |
|
|
|
|
|
$arr_prenoms_checked[$i_prenom] = true ; |
|
|
|
|
|
|
|
|
|
|
|
$nom = $arr_noms[$i_nom] ; |
|
|
|
|
|
$prenom = $arr_prenoms[$i_prenom] ; |
|
|
|
|
|
|
|
|
|
|
|
$u->nom = $nom ; |
|
|
|
|
|
$u->prenom = $prenom ; |
|
|
|
|
|
$u->email = strtolower($prenom).'.'.strtolower($nom).'@yopmail.com' ; |
|
|
|
|
|
$u->telephone = '0600000000' ; |
|
|
|
|
|
|
|
|
|
|
|
$u->save() ; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|