mirror of
https://framagit.org/tykayn/date-poll-api
synced 2023-08-25 08:23:11 +02:00
default created at
This commit is contained in:
parent
c02edb5a76
commit
d6cbd23d3f
@ -28,12 +28,9 @@ class AppPollFixtures extends Fixture {
|
||||
|
||||
$poll = new Poll();
|
||||
$poll->setTitle( 'citron ou orange' );
|
||||
$poll->setKind( 'text' );
|
||||
$poll->setDescription( 'votre sorbert préféré' );
|
||||
$poll->setAdminKey( uniqid() );
|
||||
$poll->setModificationPolicy( 'nobody' );
|
||||
|
||||
$poll->setExpiracyDate( new DateTime() );
|
||||
$poll->setMailOnVote( true );
|
||||
$poll->setOwner( $owner );
|
||||
$owner->addPoll( $poll );
|
||||
@ -74,11 +71,10 @@ class AppPollFixtures extends Fixture {
|
||||
|
||||
$poll->setTitle( 'démo sondage de texte avec deux commentaires' );
|
||||
$poll->setDescription( 'description du sondage 2' );
|
||||
$poll->setKind( 'text' );
|
||||
|
||||
$poll->setAdminKey( uniqid() );
|
||||
$poll->setModificationPolicy( 'self' );
|
||||
$poll->setMailOnComment( true );
|
||||
$poll->setExpiracyDate( new DateTime() );
|
||||
|
||||
|
||||
$poll->addTextChoiceArray( [ 'un truc', 'deux trucs' ] );
|
||||
@ -111,14 +107,14 @@ class AppPollFixtures extends Fixture {
|
||||
//
|
||||
// $poll = new Poll();
|
||||
// $poll->setTitle( 'accès restreint sondage de texte' );
|
||||
// $poll->setKind( 'text' );
|
||||
// $poll ;
|
||||
// $poll->setPassword( md5( 'mot_de_passe_super' ) );
|
||||
// $poll->setModificationPolicy( 'everybody' );
|
||||
// $poll->setDescription( 'description du sondage a accès restreint. le mot de passe est mot_de_passe_super' );
|
||||
// $poll->setAdminKey( uniqid() );
|
||||
// $poll->setCustomUrl( 'boudoum_podom_podom' );
|
||||
//
|
||||
// $poll->setExpiracyDate( new DateTime() );
|
||||
// $poll ;
|
||||
// $poll->setMailOnComment( true );
|
||||
// $poll->setMailOnVote( true );
|
||||
// $poll->setOwner( $owner );
|
||||
@ -145,7 +141,6 @@ class AppPollFixtures extends Fixture {
|
||||
|
||||
$poll->setTitle( "c'est pour aujourdhui ou pour demain" )
|
||||
->setDescription( 'Vous avez le choix dans la date' )
|
||||
->setExpiracyDate( new DateTime() )
|
||||
->setKind( 'date' )
|
||||
->setOwner( $owner )
|
||||
->addChoice( $choice )
|
||||
@ -156,8 +151,6 @@ class AppPollFixtures extends Fixture {
|
||||
$poll = new Poll();
|
||||
$poll->setTitle( 'dessin animé préféré' )
|
||||
->setDescription( 'choisissez votre animé préféré' )
|
||||
->setExpiracyDate( new DateTime() )
|
||||
->setKind( 'text' )
|
||||
->setOwner( $owner )
|
||||
->setModificationPolicy( 'self' )
|
||||
->addTextChoiceArray( [
|
||||
|
@ -37,7 +37,7 @@ class Comment {
|
||||
private $poll;
|
||||
|
||||
function __construct() {
|
||||
$this->setCreatedAt( new \DateTime() );
|
||||
$this->setCreatedAt( new \DateTime() );
|
||||
}
|
||||
|
||||
public function getId(): ?int {
|
||||
|
@ -50,7 +50,7 @@ class Owner {
|
||||
*/
|
||||
private $modifierToken;
|
||||
/**
|
||||
* @ORM\Column(type="datetime")
|
||||
* @ORM\Column(type="datetime" , options={"default"="CURRENT_TIMESTAMP"})
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
@ -62,6 +62,7 @@ class Owner {
|
||||
$this->setModifierToken( uniqid() );
|
||||
}
|
||||
|
||||
|
||||
public function getId(): ?int {
|
||||
return $this->id;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class Poll {
|
||||
*/
|
||||
public $description;
|
||||
/**
|
||||
* @ORM\Column(type="datetime")
|
||||
* @ORM\Column(type="datetime" , options={"default"="CURRENT_TIMESTAMP"})
|
||||
* @Serializer\Expose()
|
||||
*/
|
||||
public $creationDate;
|
||||
@ -60,7 +60,7 @@ class Poll {
|
||||
* @Serializer\Type("string")
|
||||
* @Serializer\Expose()
|
||||
*/
|
||||
public $kind;
|
||||
public $kind = 'text';
|
||||
/**
|
||||
* array of possible answer to each choice, by default: "yes" or nothing only.
|
||||
* could be also "yes", "maybe", "no". extensible to anything
|
||||
@ -158,7 +158,7 @@ class Poll {
|
||||
public function addDaysToDate( \DateTime $date, int $days ) {
|
||||
$st = strtotime( $date->getTimestamp() . ' + ' . $days . ' days' );
|
||||
|
||||
return new \DateTime( "@$st" );
|
||||
return new \DateTime( $st );
|
||||
}
|
||||
|
||||
public function getId(): ?int {
|
||||
|
12
src/Entity/timedTrait.php
Normal file
12
src/Entity/timedTrait.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
trait Timed {
|
||||
/**
|
||||
* @ORM\Column(type="datetime" , options={"default"="CURRENT_TIMESTAMP"})
|
||||
*/
|
||||
private $createdAt;
|
||||
}
|
Loading…
Reference in New Issue
Block a user