while ($datas = $iter->next()) { $t = microtime(true); // Creating the User $u = new User(); $u->insert($datas['eleve_id']); $u->password($datas['passwd'], false); $u->firstname(ucwords(strtolower(conv($datas['prenom'])))); $u->lastname(ucwords(strtolower(conv($datas['nom'])))); $u->nickname(conv($datas['surnom'])); $u->birthdate(new FrankizDateTime($datas['date_nais'])); $u->gender($datas['sexe'] == 1 ? User::GENDER_FEMALE : User::GENDER_MALE); if (!empty($datas['mail'])) { $u->email($datas['mail']); } try { $u->cellphone(new Phone($datas['portable'])); } catch (Exception $e) { echo 'Error for phone ' . $datas['portable'] . "\n"; } $u->poly($datas['login']); // Linking with the room $room = $datas['piece_id']; if (!empty($room)) { if (preg_match('/^[0-9]+[a-z]?$/', $room)) { $room = 'X' . $room; } if ($room = Room::from($room)) { $u->addRoom($room); } else { echo 'Error for room ' . $datas['piece_id'] . "\n"; }