diff --git a/src/Controller/MigrationController.php b/src/Controller/MigrationController.php
index 793f091..cf46a08 100755
--- a/src/Controller/MigrationController.php
+++ b/src/Controller/MigrationController.php
@@ -1,9 +1,16 @@
getDoctrine()->getManager();
- $pollsByID = [];
+ $pollsBySlug = [];
$pdo_options[ \PDO::ATTR_ERRMODE ] = \PDO::ERRMODE_EXCEPTION;
$bdd = new \PDO( 'mysql:host=localhost;dbname=' . $this->getParameter( 'OLD_DATABASE_NAME' ),
@@ -41,24 +48,37 @@ class MigrationController extends FramadateController {
$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";
+ echo "
";
+ echo "
migration du sondage $d->title , $d->id , ";
- $u = new Poll();
+ var_dump($d);
- $u
+ $newPoll = new Poll();
+ $owner = new Owner();
+
+ $owner->setEmail( $d->admin_mail )
+ ->setPseudo( $d->admin_name );
+ $owner->addPoll($newPoll);
+
+ $newPoll
+ ->setOwner( $owner )
->setCustomURL( $d->id )
+// ->setKind( $d->id === 'D' ? 'date' : 'text' )
+ ->setHideResults( ! $d->results_publicly_visible )
->setAdminKey( $d->admin_id )
->setTitle( $d->title )
+// ->setVotesAllowed( $d->receiveNewVotes )
+// ->setCommentsAllowed( $d->receiveNewComments )
+ ->setChoicesMax( $d->ValueMax )
+ ->setPassword( $d->password_hash )
->setDescription( $d->description )
->setCreationDate( date_create( $d->creation_date ) );
- $pollsByID[ $d->id ] = $u;
+ $pollsBySlug[ $d->id ] = $newPoll;
-// $u->setPseudo($d->pseudo)
-// ->setIp($d->ip)
-// ->setAge($d->age)
-// ->setsondage($s);
-// $em->persist( $u );
+
+// $em->persist( $owner );
+// $em->persist( $newPoll );
}
// $em->flush();
diff --git a/src/Entity/Poll.php b/src/Entity/Poll.php
index 4b5fced..9273427 100755
--- a/src/Entity/Poll.php
+++ b/src/Entity/Poll.php
@@ -58,7 +58,7 @@
*/
public $owner;
/**
- * kind of poll, text or date
+ * kind of poll, 'text' or 'date'
* @ORM\Column(type="string", length=255)
* @Serializer\Type("string")
* @Serializer\Expose()
@@ -72,6 +72,41 @@
* @Serializer\Expose()
*/
public $allowedAnswers;
+
+ /**
+ * people can add votes
+ * @ORM\Column(type="boolean", nullable=true)
+ * @Serializer\Type("boolean")
+ * @Serializer\Expose()
+ */
+ public $votesAllowed;
+ /**
+ * max number of stack of votes possible.
+ * limits the number of people who can answer. as long as you trust the people to give only one answer with a reliable system.
+ * @ORM\Column(type="number", nullable=true)
+ * @Serializer\Type("number")
+ * @Serializer\Expose()
+ */
+ public $votesMax;
+
+ /**
+ * max number of choices people can answer in a stack of vote. for text polls only, not date kind.
+ * by default, people can check as many answers as they want.
+ * If the question is "check your 3 favourite flavours" and displays 10 flavours, only the first 3 clicked will be taken into account. GUI should be able to make this clear and togglable so that people can change their 3 favourite flavours in their answer.
+ * @ORM\Column(type="number", nullable=true)
+ * @Serializer\Type("number")
+ * @Serializer\Expose()
+ */
+ public $choicesMax;
+
+ /**
+ * people can add comments
+ * @ORM\Column(type="boolean", nullable=true)
+ * @Serializer\Type("boolean")
+ * @Serializer\Expose()
+ */
+ public $commentsAllowed;
+
/**
* kind of way the people can modify the poll
* everybody - can modify votes