add migration for other entities
This commit is contained in:
parent
b7358021a7
commit
750692b030
@ -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
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user