getParameter( 'UNIQ_INSTALL_KEY' ) ) { return new JsonResponse( [ 'error' => 'NOPE! veuillez vérifier votre fichier .env', ] ); }; // check uniq key is good // fetch old Database // connec $debug = ''; $em = $this->getDoctrine()->getManager(); $pollsByID = []; $pdo_options[ \PDO::ATTR_ERRMODE ] = \PDO::ERRMODE_EXCEPTION; $bdd = new \PDO( 'mysql:host=localhost;dbname=' . $this->getParameter( 'OLD_DATABASE_NAME' ), $this->getParameter( 'OLD_DATABASE_USER' ), $this->getParameter( 'OLD_DATABASE_PASS' ), $pdo_options ); $res_Poll = $bdd->query( 'SELECT * FROM fd_poll' ); //boucler pour ranger while ( $d = $res_Poll->fetch( \PDO::FETCH_OBJ ) ) { echo "
migration du sondage $d->title , $d->id"; $u = new Poll(); $u ->setCustomURL( $d->id ) ->setAdminKey( $d->admin_id ) ->setTitle( $d->title ) ->setDescription( $d->description ) ->setCreationDate( date_create( $d->creation_date ) ); $pollsByID[ $d->id ] = $u; // $u->setPseudo($d->pseudo) // ->setIp($d->ip) // ->setAge($d->age) // ->setsondage($s); // $em->persist( $u ); } // $em->flush(); // gather objects // create new polls // success // failure notice return $this->json( [ "message" => "welcome to the framadate migration endpoint, it has yet to be done", "debug" => $debug, ], 200 ); } }