add migration for other entities

This commit is contained in:
Tykayn 2021-04-17 16:12:21 +02:00 committed by tykayn
parent b7358021a7
commit 750692b030
2 changed files with 25 additions and 0 deletions

View File

@ -4,6 +4,7 @@ namespace App\Controller;
//use FOS\RestBundle\Controller\Annotations\Get;
//use FOS\RestBundle\Controller\Annotations\Route;
use App\Entity\Choice;
use App\Entity\Comment;
use App\Entity\StackOfVotes;
use App\Repository\PollRepository;
use App\Service\MailService;
@ -135,6 +136,23 @@ class MigrationController extends FramadateController {
}
$res_votes = $bdd->query( 'SELECT * FROM fd_comment' );
while ( $d = $res_votes->fetch( \PDO::FETCH_OBJ ) ) {
$pollSlug = $d->poll_id;
$poll = $pollsBySlug[ $pollSlug ];
$newComment = new Comment();
$poll->addComment($newComment);
$newComment->setPoll($poll)
->setCreatedAt( date_create($d->date))
->setText( $d->comment);
// TODO update entities
// ->setPseudo( $d->pseudo)
$em->persist( $newComment );
;
}
// $em->flush();
// gather objects

View File

@ -25,6 +25,13 @@ class Comment {
*/
private $owner;
/**
* @ORM\Column(type="string")
* @Serializer\Type("string")
* @Serializer\Expose()
*/
private $pseudo;
/**
* @ORM\Column(type="text")
* @Serializer\Type("string")