mirror of
https://framagit.org/tykayn/date-poll-api
synced 2023-08-25 08:23:11 +02:00
Compare commits
8 Commits
21c594a2fd
...
6626241ce8
Author | SHA1 | Date | |
---|---|---|---|
6626241ce8 | |||
2d2607d30b | |||
1570a1cf0f | |||
108cc473e4 | |||
b6ca330826 | |||
8bc01198b8 | |||
edfb65c56e | |||
|
aab2d74b19 |
@ -70,6 +70,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"doctrine/doctrine-fixtures-bundle": "^3.4",
|
||||||
"symfony/maker-bundle": "^1.30"
|
"symfony/maker-bundle": "^1.30"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
160
composer.lock
generated
160
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "8c0122c4e542f317501dd66ea0f62a40",
|
"content-hash": "6ae23da7ab3d4ef4c0b8661a284d73c4",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "composer/package-versions-deprecated",
|
"name": "composer/package-versions-deprecated",
|
||||||
@ -6374,6 +6374,164 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [
|
"packages-dev": [
|
||||||
|
{
|
||||||
|
"name": "doctrine/data-fixtures",
|
||||||
|
"version": "1.5.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/doctrine/data-fixtures.git",
|
||||||
|
"reference": "51d3d4880d28951fff42a635a2389f8c63baddc5"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/doctrine/data-fixtures/zipball/51d3d4880d28951fff42a635a2389f8c63baddc5",
|
||||||
|
"reference": "51d3d4880d28951fff42a635a2389f8c63baddc5",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"doctrine/common": "^2.13|^3.0",
|
||||||
|
"doctrine/persistence": "^1.3.3|^2.0",
|
||||||
|
"php": "^7.2 || ^8.0"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"doctrine/phpcr-odm": "<1.3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"doctrine/coding-standard": "^8.2",
|
||||||
|
"doctrine/dbal": "^2.5.4",
|
||||||
|
"doctrine/mongodb-odm": "^1.3.0 || ^2.0.0",
|
||||||
|
"doctrine/orm": "^2.7.0",
|
||||||
|
"ext-sqlite3": "*",
|
||||||
|
"phpunit/phpunit": "^8.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"alcaeus/mongo-php-adapter": "For using MongoDB ODM 1.3 with PHP 7 (deprecated)",
|
||||||
|
"doctrine/mongodb-odm": "For loading MongoDB ODM fixtures",
|
||||||
|
"doctrine/orm": "For loading ORM fixtures",
|
||||||
|
"doctrine/phpcr-odm": "For loading PHPCR ODM fixtures"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Doctrine\\Common\\DataFixtures\\": "lib/Doctrine/Common/DataFixtures"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Jonathan Wage",
|
||||||
|
"email": "jonwage@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Data Fixtures for all Doctrine Object Managers",
|
||||||
|
"homepage": "http://www.doctrine-project.org",
|
||||||
|
"keywords": [
|
||||||
|
"database"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/doctrine/data-fixtures/issues",
|
||||||
|
"source": "https://github.com/doctrine/data-fixtures/tree/1.5.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://www.doctrine-project.org/sponsorship.html",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://www.patreon.com/phpdoctrine",
|
||||||
|
"type": "patreon"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdata-fixtures",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2021-01-23T10:20:43+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "doctrine/doctrine-fixtures-bundle",
|
||||||
|
"version": "3.4.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/doctrine/DoctrineFixturesBundle.git",
|
||||||
|
"reference": "870189619a7770f468ffb0b80925302e065a3b34"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/870189619a7770f468ffb0b80925302e065a3b34",
|
||||||
|
"reference": "870189619a7770f468ffb0b80925302e065a3b34",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"doctrine/data-fixtures": "^1.3",
|
||||||
|
"doctrine/doctrine-bundle": "^1.11|^2.0",
|
||||||
|
"doctrine/orm": "^2.6.0",
|
||||||
|
"doctrine/persistence": "^1.3.7|^2.0",
|
||||||
|
"php": "^7.1 || ^8.0",
|
||||||
|
"symfony/config": "^3.4|^4.3|^5.0",
|
||||||
|
"symfony/console": "^3.4|^4.3|^5.0",
|
||||||
|
"symfony/dependency-injection": "^3.4|^4.3|^5.0",
|
||||||
|
"symfony/doctrine-bridge": "^3.4|^4.1|^5.0",
|
||||||
|
"symfony/http-kernel": "^3.4|^4.3|^5.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"doctrine/coding-standard": "^6.0",
|
||||||
|
"phpunit/phpunit": "^7.4 || ^8.0 || ^9.2",
|
||||||
|
"symfony/phpunit-bridge": "^4.1|^5.0"
|
||||||
|
},
|
||||||
|
"type": "symfony-bundle",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Doctrine\\Bundle\\FixturesBundle\\": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Doctrine Project",
|
||||||
|
"homepage": "http://www.doctrine-project.org"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "http://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony DoctrineFixturesBundle",
|
||||||
|
"homepage": "http://www.doctrine-project.org",
|
||||||
|
"keywords": [
|
||||||
|
"Fixture",
|
||||||
|
"persistence"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/doctrine/DoctrineFixturesBundle/issues",
|
||||||
|
"source": "https://github.com/doctrine/DoctrineFixturesBundle/tree/3.4.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://www.doctrine-project.org/sponsorship.html",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://www.patreon.com/phpdoctrine",
|
||||||
|
"type": "patreon"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdoctrine-fixtures-bundle",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2020-11-14T09:36:49+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "nikic/php-parser",
|
"name": "nikic/php-parser",
|
||||||
"version": "v4.10.4",
|
"version": "v4.10.4",
|
||||||
|
@ -10,4 +10,5 @@ return [
|
|||||||
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
|
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
|
||||||
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
|
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
|
||||||
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
|
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
|
||||||
|
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
|
||||||
];
|
];
|
||||||
|
@ -1,2 +1,8 @@
|
|||||||
twig:
|
twig:
|
||||||
default_path: '%kernel.project_dir%/templates'
|
default_path: '%kernel.project_dir%/templates'
|
||||||
|
globals:
|
||||||
|
BASE_URL: '%env(BASE_URL)%'
|
||||||
|
APP_ENV: '%env(APP_ENV)%'
|
||||||
|
WEBSITE_NAME: '%env(WEBSITE_NAME)%'
|
||||||
|
WEBSITE_LOGO: '%env(WEBSITE_LOGO)%'
|
||||||
|
SUPPORT_EMAIL: '%env(SUPPORT_EMAIL)%'
|
||||||
|
@ -8,6 +8,8 @@ parameters:
|
|||||||
OLD_DATABASE_USER: '%env(OLD_DATABASE_USER)%'
|
OLD_DATABASE_USER: '%env(OLD_DATABASE_USER)%'
|
||||||
OLD_DATABASE_PASS: '%env(OLD_DATABASE_PASS)%'
|
OLD_DATABASE_PASS: '%env(OLD_DATABASE_PASS)%'
|
||||||
UNIQ_INSTALL_KEY: '%env(UNIQ_INSTALL_KEY)%'
|
UNIQ_INSTALL_KEY: '%env(UNIQ_INSTALL_KEY)%'
|
||||||
|
WEBSITE_NAME: '%env(WEBSITE_NAME)%'
|
||||||
|
WEBSITE_LOGO: '%env(WEBSITE_LOGO)%'
|
||||||
services:
|
services:
|
||||||
# default configuration for services in *this* file
|
# default configuration for services in *this* file
|
||||||
_defaults:
|
_defaults:
|
||||||
|
80
doc/SCHEMA:framadate_api.uml
Normal file
80
doc/SCHEMA:framadate_api.uml
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Diagram>
|
||||||
|
<ID>DATABASE</ID>
|
||||||
|
<OriginalElement>2c3996c6-29d5-4c17-9504-1606d308e53c.SCHEMA:framadate_api</OriginalElement>
|
||||||
|
<nodes>
|
||||||
|
<node x="0.0" y="1296.0">2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.stack_of_votes</node>
|
||||||
|
<node x="307.25" y="0.0">2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.owner</node>
|
||||||
|
<node x="615.25" y="1256.0">2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.comment</node>
|
||||||
|
<node x="251.140625" y="347.0">2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.poll</node>
|
||||||
|
<node x="250.90625" y="1605.0">2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.vote</node>
|
||||||
|
<node x="297.0" y="1276.0">2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.choice</node>
|
||||||
|
</nodes>
|
||||||
|
<notes />
|
||||||
|
<edges>
|
||||||
|
<edge source="2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.comment" target="2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.owner" relationship="REFERENCES">
|
||||||
|
<point x="70.5" y="-148.5" />
|
||||||
|
<point x="826.75" y="322.0" />
|
||||||
|
<point x="507.75" y="322.0" />
|
||||||
|
<point x="0.0" y="148.5" />
|
||||||
|
</edge>
|
||||||
|
<edge source="2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.comment" target="2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.poll" relationship="REFERENCES">
|
||||||
|
<point x="-70.5" y="-148.5" />
|
||||||
|
<point x="685.75" y="1230.0" />
|
||||||
|
<point x="509.140625" y="1230.0" />
|
||||||
|
<point x="0.0" y="428.5" />
|
||||||
|
</edge>
|
||||||
|
<edge source="2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.vote" target="2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.choice" relationship="REFERENCES">
|
||||||
|
<point x="0.0" y="-148.5" />
|
||||||
|
<point x="409.40625" y="1579.0" />
|
||||||
|
<point x="434.0" y="1579.0" />
|
||||||
|
<point x="0.0" y="128.5" />
|
||||||
|
</edge>
|
||||||
|
<edge source="2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.stack_of_votes" target="2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.owner" relationship="REFERENCES">
|
||||||
|
<point x="-69.25" y="-108.5" />
|
||||||
|
<point x="69.25" y="322.0" />
|
||||||
|
<point x="507.75" y="322.0" />
|
||||||
|
<point x="0.0" y="148.5" />
|
||||||
|
</edge>
|
||||||
|
<edge source="2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.stack_of_votes" target="2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.poll" relationship="REFERENCES">
|
||||||
|
<point x="69.25" y="-108.5" />
|
||||||
|
<point x="207.75" y="1230.0" />
|
||||||
|
<point x="509.140625" y="1230.0" />
|
||||||
|
<point x="0.0" y="428.5" />
|
||||||
|
</edge>
|
||||||
|
<edge source="2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.vote" target="2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.stack_of_votes" relationship="REFERENCES">
|
||||||
|
<point x="-105.66666666666669" y="-148.5" />
|
||||||
|
<point x="303.7395833333333" y="1579.0" />
|
||||||
|
<point x="138.5" y="1579.0" />
|
||||||
|
<point x="0.0" y="108.5" />
|
||||||
|
</edge>
|
||||||
|
<edge source="2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.poll" target="2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.owner" relationship="REFERENCES">
|
||||||
|
<point x="0.0" y="-428.5" />
|
||||||
|
<point x="509.140625" y="322.0" />
|
||||||
|
<point x="507.75" y="322.0" />
|
||||||
|
<point x="0.0" y="148.5" />
|
||||||
|
</edge>
|
||||||
|
<edge source="2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.vote" target="2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.poll" relationship="REFERENCES">
|
||||||
|
<point x="105.66666666666663" y="-148.5" />
|
||||||
|
<point x="515.0729166666666" y="1579.0" />
|
||||||
|
<point x="581.5" y="1579.0" />
|
||||||
|
<point x="581.5" y="1230.0" />
|
||||||
|
<point x="509.140625" y="1230.0" />
|
||||||
|
<point x="0.0" y="428.5" />
|
||||||
|
</edge>
|
||||||
|
<edge source="2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.choice" target="2c3996c6-29d5-4c17-9504-1606d308e53c.TABLE:framadate_api.poll" relationship="REFERENCES">
|
||||||
|
<point x="0.0" y="-128.5" />
|
||||||
|
<point x="434.0" y="1230.0" />
|
||||||
|
<point x="509.140625" y="1230.0" />
|
||||||
|
<point x="0.0" y="428.5" />
|
||||||
|
</edge>
|
||||||
|
</edges>
|
||||||
|
<settings layout="Hierarchic" zoom="0.3090530697190427" showDependencies="false" x="449.0" y="951.0" />
|
||||||
|
<SelectedNodes />
|
||||||
|
<Categories>
|
||||||
|
<Category>Columns</Category>
|
||||||
|
<Category>Key columns</Category>
|
||||||
|
<Category>Virtual foreign keys</Category>
|
||||||
|
</Categories>
|
||||||
|
</Diagram>
|
||||||
|
|
BIN
doc/framadate_api.png
Normal file
BIN
doc/framadate_api.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 192 KiB |
1346
doc/framadate_api.svg
Normal file
1346
doc/framadate_api.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 147 KiB |
@ -11,7 +11,7 @@ use FOS\RestBundle\Controller\Annotations\Route;
|
|||||||
* @package App\Controller
|
* @package App\Controller
|
||||||
* @Route("/admin",name="admin_homepage")
|
* @Route("/admin",name="admin_homepage")
|
||||||
*/
|
*/
|
||||||
class AdminController extends FramadateController {
|
class AdminController extends EmailsController {
|
||||||
/**
|
/**
|
||||||
* @Get(path ="/",
|
* @Get(path ="/",
|
||||||
* name = "_get_default")
|
* name = "_get_default")
|
||||||
|
@ -17,7 +17,7 @@ use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
|
|||||||
* @package App\Controller
|
* @package App\Controller
|
||||||
* @Route("/",name="home_")
|
* @Route("/",name="home_")
|
||||||
*/
|
*/
|
||||||
class DefaultController extends FramadateController {
|
class DefaultController extends EmailsController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Get(path ="/",
|
* @Get(path ="/",
|
||||||
@ -27,7 +27,7 @@ class DefaultController extends FramadateController {
|
|||||||
|
|
||||||
$polls = $this->getDoctrine()->getRepository( Poll::class )->findAll();
|
$polls = $this->getDoctrine()->getRepository( Poll::class )->findAll();
|
||||||
|
|
||||||
return $this->render( 'pages/home.html.twig',[ ]);
|
return $this->render( 'pages/home.html.twig', [] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,10 +11,10 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|||||||
/**
|
/**
|
||||||
* sending emails controller
|
* sending emails controller
|
||||||
*
|
*
|
||||||
* Class FramadateController
|
* Class EmailsController
|
||||||
* @package App\Controller
|
* @package App\Controller
|
||||||
*/
|
*/
|
||||||
class FramadateController extends AbstractController {
|
class EmailsController extends AbstractController {
|
||||||
|
|
||||||
private $mail_service;
|
private $mail_service;
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ class FramadateController extends AbstractController {
|
|||||||
|
|
||||||
$config = [
|
$config = [
|
||||||
'owner' => $owner,
|
'owner' => $owner,
|
||||||
'title' => 'Framadate | Mes sondages',
|
'title' => $this->getParameter( 'WEBSITE_NAME' ) . ' | Mes sondages',
|
||||||
'email_template' => 'emails/owner-list.html.twig',
|
'email_template' => 'emails/owner-list.html.twig',
|
||||||
];
|
];
|
||||||
$this->sendMailWithVars( $config );
|
$this->sendMailWithVars( $config );
|
@ -21,7 +21,7 @@ use App\Entity\Poll;
|
|||||||
* @package App\Controller
|
* @package App\Controller
|
||||||
* @Route("/migration-from-v1",name="admin_homepage")
|
* @Route("/migration-from-v1",name="admin_homepage")
|
||||||
*/
|
*/
|
||||||
class MigrationController extends FramadateController {
|
class MigrationController extends EmailsController {
|
||||||
/**
|
/**
|
||||||
* @Get(path ="/{unique_key}",
|
* @Get(path ="/{unique_key}",
|
||||||
* name = "_migrate_from_v1")
|
* name = "_migrate_from_v1")
|
||||||
|
@ -14,7 +14,7 @@ use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
|
|||||||
* @package App\Controller
|
* @package App\Controller
|
||||||
* @Route("/user",name="user_homepage")
|
* @Route("/user",name="user_homepage")
|
||||||
*/
|
*/
|
||||||
class OwnerController extends FramadateController {
|
class OwnerController extends EmailsController {
|
||||||
/**
|
/**
|
||||||
* @Get(path ="/",
|
* @Get(path ="/",
|
||||||
* name = "get_default")
|
* name = "get_default")
|
||||||
|
@ -29,7 +29,8 @@ class PollController extends AbstractController
|
|||||||
}
|
}
|
||||||
return $this->render('poll/index.html.twig', [
|
return $this->render('poll/index.html.twig', [
|
||||||
'count' => count($polls),
|
'count' => count($polls),
|
||||||
'polls' => $titles,
|
'titles' => $titles,
|
||||||
|
'polls' => $polls,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller\api;
|
||||||
|
|
||||||
|
use App\Controller\EmailsController;
|
||||||
use App\Entity\Comment;
|
use App\Entity\Comment;
|
||||||
use App\Entity\Owner;
|
use App\Entity\Owner;
|
||||||
use App\Entity\Poll;
|
use App\Entity\Poll;
|
||||||
@ -21,7 +22,7 @@ use Symfony\Component\HttpFoundation\Response;
|
|||||||
* @package App\Controller
|
* @package App\Controller
|
||||||
* @Route("/api/v1",name="api_")
|
* @Route("/api/v1",name="api_")
|
||||||
*/
|
*/
|
||||||
class CommentController extends FramadateController {
|
class CommentController extends EmailsController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Get(
|
* @Get(
|
||||||
@ -32,18 +33,18 @@ class CommentController extends FramadateController {
|
|||||||
*/
|
*/
|
||||||
public
|
public
|
||||||
function getPollCommentsAction(
|
function getPollCommentsAction(
|
||||||
SerializerInterface $serializer,
|
SerializerInterface $serializer,
|
||||||
Poll $poll
|
Poll $poll
|
||||||
) {
|
) {
|
||||||
$jsonResponse = $serializer->serialize([
|
$jsonResponse = $serializer->serialize([
|
||||||
'message' => 'here are your comments of the poll',
|
'message' => 'here are your comments of the poll',
|
||||||
'data' => $poll->getComments()], 'json');
|
'data' => $poll->getComments()], 'json');
|
||||||
|
|
||||||
$response = new Response($jsonResponse);
|
$response = new Response($jsonResponse);
|
||||||
$response->headers->set('Content-Type', 'application/json');
|
$response->headers->set('Content-Type', 'application/json');
|
||||||
$response->setStatusCode(200);
|
$response->setStatusCode(200);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,8 +81,8 @@ class CommentController extends FramadateController {
|
|||||||
if ( ! $foundOwner ) {
|
if ( ! $foundOwner ) {
|
||||||
$foundOwner = new Owner();
|
$foundOwner = new Owner();
|
||||||
$foundOwner->setPseudo( $data[ 'email' ] )
|
$foundOwner->setPseudo( $data[ 'email' ] )
|
||||||
->setEmail( $data[ 'email' ] )
|
->setEmail( $data[ 'email' ] )
|
||||||
->setModifierToken( uniqid( '', true ) );
|
->setModifierToken( uniqid( '', true ) );
|
||||||
}
|
}
|
||||||
// anti flood
|
// anti flood
|
||||||
$seconds_limit_lastpost = 5;
|
$seconds_limit_lastpost = 5;
|
||||||
@ -117,8 +118,8 @@ class CommentController extends FramadateController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$comment->setOwner( $foundOwner )
|
$comment->setOwner( $foundOwner )
|
||||||
->setCreatedAt( new DateTime() )
|
->setCreatedAt( new DateTime() )
|
||||||
->setPoll( $poll );
|
->setPoll( $poll );
|
||||||
$foundOwner->addComment( $comment );
|
$foundOwner->addComment( $comment );
|
||||||
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Controller\api;
|
namespace App\Controller\api;
|
||||||
|
|
||||||
use App\Controller\FramadateController;
|
use App\Controller\EmailsController;
|
||||||
use App\Entity\Choice;
|
use App\Entity\Choice;
|
||||||
use App\Entity\Owner;
|
use App\Entity\Owner;
|
||||||
use App\Entity\Poll;
|
use App\Entity\Poll;
|
||||||
@ -27,15 +27,15 @@ use FOS\RestBundle\Controller\Annotations\Route;
|
|||||||
* @package App\Controller
|
* @package App\Controller
|
||||||
* @Route("/api/v1/poll",name="api_")
|
* @Route("/api/v1/poll",name="api_")
|
||||||
*/
|
*/
|
||||||
class PollController extends FramadateController {
|
class PollController extends EmailsController {
|
||||||
/**
|
/**
|
||||||
* @Get(
|
* @Get(
|
||||||
* path = "/",
|
* path = "/",
|
||||||
* name = "get_all_polls"
|
* name = "get_all_polls"
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function getAllPollsAction(PollRepository $pollRepository): Response {
|
public function getAllPollsAction( PollRepository $pollRepository ): Response {
|
||||||
$data = $pollRepository->findAll();
|
$data = $pollRepository->findAll();
|
||||||
|
|
||||||
|
|
||||||
$polls = $data;
|
$polls = $data;
|
||||||
@ -76,9 +76,8 @@ class PollController extends FramadateController {
|
|||||||
/**
|
/**
|
||||||
* get a poll config by its custom URL, we do not want polls to be reachable by their numeric id
|
* get a poll config by its custom URL, we do not want polls to be reachable by their numeric id
|
||||||
* @Get(
|
* @Get(
|
||||||
* path = "/{id}",
|
* path = "/{customUrl}",
|
||||||
* name = "get_poll",
|
* name = "get_poll"
|
||||||
* requirements = {"id"="\w+"}
|
|
||||||
* )
|
* )
|
||||||
*
|
*
|
||||||
* @param SerializerInterface $serializer
|
* @param SerializerInterface $serializer
|
||||||
@ -88,14 +87,14 @@ class PollController extends FramadateController {
|
|||||||
*/
|
*/
|
||||||
public function getPollConfig(
|
public function getPollConfig(
|
||||||
SerializerInterface $serializer,
|
SerializerInterface $serializer,
|
||||||
$id,
|
$customUrl,
|
||||||
Request $request
|
Request $request
|
||||||
): Response {
|
): Response {
|
||||||
$repository = $this->getDoctrine()->getRepository( Poll::class );
|
$repository = $this->getDoctrine()->getRepository( Poll::class );
|
||||||
$poll = $repository->findOneByCustomUrl( $id );
|
$poll = $repository->findOneByCustomUrl( $customUrl );
|
||||||
|
|
||||||
if ( ! $poll ) {
|
if ( ! $poll ) {
|
||||||
return $this->notFoundPoll($id);
|
return $this->notFoundPoll( $customUrl );
|
||||||
}
|
}
|
||||||
|
|
||||||
$comments = $poll->getComments();
|
$comments = $poll->getComments();
|
||||||
@ -134,9 +133,8 @@ class PollController extends FramadateController {
|
|||||||
/**
|
/**
|
||||||
* get a poll config by its custom URL, we do not want polls to be reachable by their numeric id
|
* get a poll config by its custom URL, we do not want polls to be reachable by their numeric id
|
||||||
* @Get(
|
* @Get(
|
||||||
* path = "/{id}/pass/{md5}",
|
* path = "/{customUrl}/pass/{md5}",
|
||||||
* name = "get_protected_poll",
|
* name = "get_protected_poll",
|
||||||
* requirements = {"id"="\w+"}
|
|
||||||
* )
|
* )
|
||||||
*
|
*
|
||||||
* @param SerializerInterface $serializer
|
* @param SerializerInterface $serializer
|
||||||
@ -144,12 +142,12 @@ class PollController extends FramadateController {
|
|||||||
*
|
*
|
||||||
* @return JsonResponse|Response
|
* @return JsonResponse|Response
|
||||||
*/
|
*/
|
||||||
function getProtectedPoll($id,$md5, SerializerInterface $serializer){
|
function getProtectedPoll($customUrl,$md5, SerializerInterface $serializer){
|
||||||
$repository = $this->getDoctrine()->getRepository( Poll::class );
|
$repository = $this->getDoctrine()->getRepository( Poll::class );
|
||||||
$poll = $repository->findOneByCustomUrl( $id );
|
$poll = $repository->findOneByCustomUrl( $customUrl );
|
||||||
|
|
||||||
if ( ! $poll ) {
|
if ( ! $poll ) {
|
||||||
return $this->notFoundPoll($id);
|
return $this->notFoundPoll($customUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $poll->getPassword() === $md5 ) {
|
if ( $poll->getPassword() === $md5 ) {
|
||||||
@ -180,7 +178,7 @@ class PollController extends FramadateController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @Put(
|
* @Put(
|
||||||
* path = "/{id}/{token}",
|
* path = "/{customUrl}/{token}",
|
||||||
* name = "update_poll",
|
* name = "update_poll",
|
||||||
* requirements = {"content"="\w+", "poll_id"="\d+"}
|
* requirements = {"content"="\w+", "poll_id"="\d+"}
|
||||||
* )
|
* )
|
||||||
@ -363,7 +361,7 @@ class PollController extends FramadateController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @Delete(
|
* @Delete(
|
||||||
* path = "/{id}",
|
* path = "/{customUrl}",
|
||||||
* name = "poll_delete",
|
* name = "poll_delete",
|
||||||
* requirements = {"accessToken"="\w+", "poll_id"="\d+"}
|
* requirements = {"accessToken"="\w+", "poll_id"="\d+"}
|
||||||
* )
|
* )
|
||||||
@ -397,13 +395,13 @@ class PollController extends FramadateController {
|
|||||||
/**
|
/**
|
||||||
* Checks if a slug is already taken by a poll
|
* Checks if a slug is already taken by a poll
|
||||||
* @Get(
|
* @Get(
|
||||||
* path = "/slug/{slug}",
|
* path = "/slug/{customUrl}",
|
||||||
* name = "check_slug_is_unique",
|
* name = "check_slug_is_unique",
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function checkSlugIsUniqueAction( string $slug ) {
|
public function checkSlugIsUniqueAction( string $customUrl ) {
|
||||||
$emPoll = $this->getDoctrine()->getRepository( Poll::class );
|
$emPoll = $this->getDoctrine()->getRepository( Poll::class );
|
||||||
$found = $emPoll->findOneByCustomUrl( $slug );
|
$found = $emPoll->findOneByCustomUrl( $customUrl );
|
||||||
$elaborated_message_version = false;
|
$elaborated_message_version = false;
|
||||||
|
|
||||||
if ( $found ) {
|
if ( $found ) {
|
||||||
@ -416,7 +414,7 @@ class PollController extends FramadateController {
|
|||||||
return $this->json( [
|
return $this->json( [
|
||||||
'message' => ' NO, this slug is already taken on this Framadate instance ',
|
'message' => ' NO, this slug is already taken on this Framadate instance ',
|
||||||
'data' => [
|
'data' => [
|
||||||
'slug' => $slug,
|
'slug' => $customUrl,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
204 );
|
204 );
|
||||||
@ -429,7 +427,7 @@ class PollController extends FramadateController {
|
|||||||
return $this->json( [
|
return $this->json( [
|
||||||
'message' => ' yes this slug is available on this Framadate instance ',
|
'message' => ' yes this slug is available on this Framadate instance ',
|
||||||
'data' => [
|
'data' => [
|
||||||
'slug' => $slug,
|
'slug' => $customUrl,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
404 );
|
404 );
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller\api;
|
||||||
|
|
||||||
|
use App\Controller\EmailsController;
|
||||||
use App\Entity\Choice;
|
use App\Entity\Choice;
|
||||||
use App\Entity\Owner;
|
use App\Entity\Owner;
|
||||||
use App\Entity\Poll;
|
use App\Entity\Poll;
|
||||||
@ -21,25 +22,25 @@ use Symfony\Component\HttpFoundation\Response;
|
|||||||
* @package App\Controller
|
* @package App\Controller
|
||||||
* @Route("/api/v1",name="api_")
|
* @Route("/api/v1",name="api_")
|
||||||
*/
|
*/
|
||||||
class VoteController extends FramadateController {
|
class VoteController extends EmailsController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add a vote stack on a poll
|
* add a vote stack on a poll
|
||||||
* @Post(
|
* @Post(
|
||||||
* path = "/poll/{id}/answer",
|
* path = "/poll/{id}/answer",
|
||||||
* name = "new_vote_stack",
|
* name = "new_vote_stack",
|
||||||
* requirements = {"content"="\w+", "poll_id"="\d+"}
|
* requirements = {"content"="\w+", "poll_id"="\d+"}
|
||||||
* )
|
* )
|
||||||
* @param SerializerInterface $serializer
|
* @param SerializerInterface $serializer
|
||||||
* @param Poll $poll
|
* @param Poll $poll
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse|Response
|
* @return JsonResponse|Response
|
||||||
*/
|
*/
|
||||||
public function newVoteStackAction(
|
public function newVoteStackAction(
|
||||||
SerializerInterface $serializer,
|
SerializerInterface $serializer,
|
||||||
Poll $poll,
|
Poll $poll,
|
||||||
Request $request
|
Request $request
|
||||||
) {
|
) {
|
||||||
if ( ! $poll ) {
|
if ( ! $poll ) {
|
||||||
return $this->json( [ 'message' => 'poll not found' ], 404 );
|
return $this->json( [ 'message' => 'poll not found' ], 404 );
|
||||||
@ -95,8 +96,8 @@ class VoteController extends FramadateController {
|
|||||||
404 );
|
404 );
|
||||||
}
|
}
|
||||||
$vote->setPoll( $poll )
|
$vote->setPoll( $poll )
|
||||||
->setChoice( $foundChoice )
|
->setChoice( $foundChoice )
|
||||||
->setValue( $voteInfo[ 'value' ] );
|
->setValue( $voteInfo[ 'value' ] );
|
||||||
$vote->setPoll( $poll );
|
$vote->setPoll( $poll );
|
||||||
$stack->addVote( $vote );
|
$stack->addVote( $vote );
|
||||||
$poll->addVote( $vote );
|
$poll->addVote( $vote );
|
||||||
@ -113,7 +114,7 @@ class VoteController extends FramadateController {
|
|||||||
if ( $existingOwner ) {
|
if ( $existingOwner ) {
|
||||||
$precision = ' from an existing owner : ' . $foundOwner->getEmail();
|
$precision = ' from an existing owner : ' . $foundOwner->getEmail();
|
||||||
}
|
}
|
||||||
$stacks = $poll->getStacksOfVotes();
|
$stacks = $poll->getStacksOfVotes();
|
||||||
|
|
||||||
if($poll->getMailOnVote()){
|
if($poll->getMailOnVote()){
|
||||||
$this->sendVoteNotificationAction($stack->getOwner(), $stack);
|
$this->sendVoteNotificationAction($stack->getOwner(), $stack);
|
||||||
@ -121,36 +122,36 @@ class VoteController extends FramadateController {
|
|||||||
|
|
||||||
$returnedVoteStack = $stack;
|
$returnedVoteStack = $stack;
|
||||||
|
|
||||||
$jsonResponse = $serializer->serialize($returnedVoteStack, 'json');
|
$jsonResponse = $serializer->serialize($returnedVoteStack, 'json');
|
||||||
|
|
||||||
$response = new Response($jsonResponse);
|
$response = new Response($jsonResponse);
|
||||||
$response->headers->set('Content-Type', 'application/json');
|
$response->headers->set('Content-Type', 'application/json');
|
||||||
$response->setStatusCode(200);
|
$response->setStatusCode(200);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* update vote stack
|
* update vote stack
|
||||||
* @Patch(
|
* @Patch(
|
||||||
* path = "/vote-stack/{id}/token/{modifierToken}",
|
* path = "/vote-stack/{id}/token/{modifierToken}",
|
||||||
* name = "update_vote_stack",
|
* name = "update_vote_stack",
|
||||||
* requirements = { "id"="\d+"}
|
* requirements = { "id"="\d+"}
|
||||||
* )
|
* )
|
||||||
* @param SerializerInterface $serializer
|
* @param SerializerInterface $serializer
|
||||||
* @param StackOfVotes $id
|
* @param StackOfVotes $id
|
||||||
* @param $modifierToken
|
* @param $modifierToken
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse|Response
|
* @return JsonResponse|Response
|
||||||
*/
|
*/
|
||||||
public
|
public
|
||||||
function updateVoteStackAction(
|
function updateVoteStackAction(
|
||||||
SerializerInterface $serializer,
|
SerializerInterface $serializer,
|
||||||
StackOfVotes $id,
|
StackOfVotes $id,
|
||||||
$modifierToken,
|
$modifierToken,
|
||||||
Request $request
|
Request $request
|
||||||
) {
|
) {
|
||||||
$voteStack = $id;
|
$voteStack = $id;
|
||||||
if ( ! $voteStack ) {
|
if ( ! $voteStack ) {
|
||||||
@ -170,17 +171,17 @@ class VoteController extends FramadateController {
|
|||||||
// save evrything
|
// save evrything
|
||||||
|
|
||||||
|
|
||||||
$jsonResponse = $serializer->serialize([
|
$jsonResponse = $serializer->serialize([
|
||||||
'message' => 'ok',
|
'message' => 'ok',
|
||||||
'modifier_token' => $voteStack->getOwner()->getModifierToken(),
|
'modifier_token' => $voteStack->getOwner()->getModifierToken(),
|
||||||
'vote_stack' => $voteStack,
|
'vote_stack' => $voteStack,
|
||||||
], 'json');
|
], 'json');
|
||||||
|
|
||||||
$response = new Response($jsonResponse);
|
$response = new Response($jsonResponse);
|
||||||
$response->headers->set('Content-Type', 'application/json');
|
$response->headers->set('Content-Type', 'application/json');
|
||||||
$response->setStatusCode(200);
|
$response->setStatusCode(200);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -3,7 +3,8 @@
|
|||||||
namespace App\DataFixtures;
|
namespace App\DataFixtures;
|
||||||
|
|
||||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||||
use Doctrine\Common\Persistence\ObjectManager;
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
|
||||||
|
|
||||||
class AppFixtures extends Fixture
|
class AppFixtures extends Fixture
|
||||||
{
|
{
|
||||||
|
@ -10,9 +10,11 @@ use App\Entity\StackOfVotes;
|
|||||||
use App\Entity\Vote;
|
use App\Entity\Vote;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||||
use Doctrine\Common\Persistence\ObjectManager;
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
|
||||||
class AppPollFixtures extends Fixture {
|
class AppPollFixtures extends Fixture {
|
||||||
|
public const POLL_FIXTURE_ONE = 'citron-poll-fixture';
|
||||||
|
|
||||||
public function load( ObjectManager $manager ) {
|
public function load( ObjectManager $manager ) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,41 +37,44 @@ class AppPollFixtures extends Fixture {
|
|||||||
$manager->flush();
|
$manager->flush();
|
||||||
|
|
||||||
|
|
||||||
$poll = new Poll();
|
$pollCitronOrange = new Poll();
|
||||||
$poll->setTitle( 'citron ou orange' )
|
$pollCitronOrange->setTitle( 'citron ou orange' )
|
||||||
->setCustomUrl('citron')
|
->setCustomUrl('citron')
|
||||||
->setDescription( 'votre sorbert préféré' )
|
->setDescription( 'votre sorbert préféré' )
|
||||||
->setAdminKey( uniqid() )
|
->setAdminKey( uniqid() )
|
||||||
->setModificationPolicy( 'nobody' )
|
->setModificationPolicy( 'nobody' )
|
||||||
->setPassword('le pass woute woute');
|
->setPassword('le pass woute woute');
|
||||||
$poll->setMailOnVote( true );
|
|
||||||
$poll->setOwner( $owner );
|
$this->addReference(self::POLL_FIXTURE_ONE, $pollCitronOrange);
|
||||||
$owner->addPoll( $poll );
|
|
||||||
|
$pollCitronOrange->setMailOnVote( true );
|
||||||
|
$pollCitronOrange->setOwner( $owner );
|
||||||
|
$owner->addPoll( $pollCitronOrange );
|
||||||
|
|
||||||
$choiceA = new Choice();
|
$choiceA = new Choice();
|
||||||
$choiceA->setName( 'citron' );
|
$choiceA->setName( 'citron' );
|
||||||
$choiceB = new Choice();
|
$choiceB = new Choice();
|
||||||
$choiceB->setName( 'orange' );
|
$choiceB->setName( 'orange' );
|
||||||
|
|
||||||
$poll
|
$pollCitronOrange
|
||||||
->addChoice( $choiceA )
|
->addChoice( $choiceA )
|
||||||
->addChoice( $choiceB );
|
->addChoice( $choiceB );
|
||||||
$manager->persist( $poll );
|
$manager->persist( $pollCitronOrange );
|
||||||
|
|
||||||
$stack1 = new StackOfVotes();
|
$stack1 = new StackOfVotes();
|
||||||
$stack1
|
$stack1
|
||||||
->setPoll( $poll )
|
->setPoll( $pollCitronOrange )
|
||||||
->setOwner( $voter );
|
->setOwner( $voter );
|
||||||
|
|
||||||
$voteA = new Vote();
|
$voteA = new Vote();
|
||||||
$voteA
|
$voteA
|
||||||
->setPoll( $poll )
|
->setPoll( $pollCitronOrange )
|
||||||
->setStacksOfVotes( $stack1 )
|
->setStacksOfVotes( $stack1 )
|
||||||
->setValue( "yes" )
|
->setValue( "yes" )
|
||||||
->setChoice( $choiceA );
|
->setChoice( $choiceA );
|
||||||
$voteB = new Vote();
|
$voteB = new Vote();
|
||||||
$voteB
|
$voteB
|
||||||
->setPoll( $poll )
|
->setPoll( $pollCitronOrange )
|
||||||
->setStacksOfVotes( $stack1 )
|
->setStacksOfVotes( $stack1 )
|
||||||
->setValue( "yes" )
|
->setValue( "yes" )
|
||||||
->setChoice( $choiceB );
|
->setChoice( $choiceB );
|
||||||
@ -81,12 +86,12 @@ class AppPollFixtures extends Fixture {
|
|||||||
$stack2 = new StackOfVotes();
|
$stack2 = new StackOfVotes();
|
||||||
$stack2->setPseudo( 'Jean indécis' );
|
$stack2->setPseudo( 'Jean indécis' );
|
||||||
$stack2
|
$stack2
|
||||||
->setPoll( $poll )
|
->setPoll( $pollCitronOrange )
|
||||||
->setOwner( $voter );
|
->setOwner( $voter );
|
||||||
|
|
||||||
$voteA = new Vote();
|
$voteA = new Vote();
|
||||||
$voteA
|
$voteA
|
||||||
->setPoll( $poll )
|
->setPoll( $pollCitronOrange )
|
||||||
->setStacksOfVotes( $stack2 )
|
->setStacksOfVotes( $stack2 )
|
||||||
->setValue( "maybe" )
|
->setValue( "maybe" )
|
||||||
->setChoice( $choiceA );
|
->setChoice( $choiceA );
|
||||||
@ -94,35 +99,37 @@ class AppPollFixtures extends Fixture {
|
|||||||
$manager->persist( $stack2 );
|
$manager->persist( $stack2 );
|
||||||
|
|
||||||
|
|
||||||
$poll = new Poll();
|
$pollCitronOrange = new Poll();
|
||||||
|
|
||||||
$ownerComment = new Comment();
|
$ownerComment = new Comment();
|
||||||
$ownerComment
|
$ownerComment
|
||||||
->setText( "trop bien ce sondage wohooo! signé l'auteur." )
|
->setText( "trop bien ce sondage wohooo! signé l'auteur." )
|
||||||
|
->setPseudo('un gens qui commente')
|
||||||
->setOwner( $owner );
|
->setOwner( $owner );
|
||||||
$poll->addComment( $ownerComment );
|
$pollCitronOrange->addComment( $ownerComment );
|
||||||
|
|
||||||
$someoneComment = new Comment();
|
$someoneComment = new Comment();
|
||||||
$someoneComment
|
$someoneComment
|
||||||
->setText( "comme l'auteur se la raconte. PFFFF!" )
|
->setText( "comme l'auteur se la raconte. PFFFF!" )
|
||||||
|
->setPseudo('un gens qui commente')
|
||||||
->setOwner( $commenterMan );
|
->setOwner( $commenterMan );
|
||||||
$poll->addComment( $someoneComment );
|
$pollCitronOrange->addComment( $someoneComment );
|
||||||
|
|
||||||
|
|
||||||
$poll->setTitle( 'démo sondage de texte avec deux commentaires' )
|
$pollCitronOrange->setTitle( 'démo sondage de texte avec deux commentaires' )
|
||||||
->setCustomUrl('demo')
|
->setCustomUrl('demo')
|
||||||
->setDescription( 'description du sondage 2' );
|
->setDescription( 'description du sondage 2' );
|
||||||
|
|
||||||
$poll->setAdminKey( uniqid() );
|
$pollCitronOrange->setAdminKey( uniqid() );
|
||||||
$poll->setModificationPolicy( 'self' );
|
$pollCitronOrange->setModificationPolicy( 'self' );
|
||||||
$poll->setMailOnComment( true );
|
$pollCitronOrange->setMailOnComment( true );
|
||||||
|
|
||||||
|
|
||||||
$poll->addTextChoiceArray( [ 'un truc', 'deux trucs' ] );
|
$pollCitronOrange->addTextChoiceArray( [ 'un truc', 'deux trucs' ] );
|
||||||
$poll->setOwner( $owner );
|
$pollCitronOrange->setOwner( $owner );
|
||||||
$owner->addPoll( $poll );
|
$owner->addPoll( $pollCitronOrange );
|
||||||
|
|
||||||
$manager->persist( $poll );
|
$manager->persist( $pollCitronOrange );
|
||||||
$manager->persist( $someoneComment );
|
$manager->persist( $someoneComment );
|
||||||
$manager->persist( $ownerComment );
|
$manager->persist( $ownerComment );
|
||||||
|
|
||||||
@ -130,16 +137,16 @@ class AppPollFixtures extends Fixture {
|
|||||||
// voting test with 2 people
|
// voting test with 2 people
|
||||||
|
|
||||||
// poll with date type
|
// poll with date type
|
||||||
$poll = new Poll();
|
$pollCitronOrange = new Poll();
|
||||||
$choice = new Choice();
|
$choice = new Choice();
|
||||||
$firstDate = new DateTime();
|
$firstDate = new DateTime();
|
||||||
$choice->setName( $firstDate->format( 'Y-m-d H:i:s' ) );
|
$choice->setName( $firstDate->format( 'Y-m-d H:i:s' ) );
|
||||||
$choice2 = new Choice();
|
$choice2 = new Choice();
|
||||||
$choice3 = new Choice();
|
$choice3 = new Choice();
|
||||||
$choice2->setName( $poll->addDaysToDate( $firstDate, 1 )->format( 'Y-m-d H:i:s' ) );
|
$choice2->setName( $pollCitronOrange->addDaysToDate( $firstDate, 1 )->format( 'Y-m-d H:i:s' ) );
|
||||||
$choice3->setName( $poll->addDaysToDate( $firstDate, 2 )->format( 'Y-m-d H:i:s' ) );
|
$choice3->setName( $pollCitronOrange->addDaysToDate( $firstDate, 2 )->format( 'Y-m-d H:i:s' ) );
|
||||||
|
|
||||||
$poll->setTitle( "c'est pour aujourdhui ou pour demain" )
|
$pollCitronOrange->setTitle( "c'est pour aujourdhui ou pour demain" )
|
||||||
->setCustomUrl('aujourdhui-ou-demain')
|
->setCustomUrl('aujourdhui-ou-demain')
|
||||||
->setDescription( 'Vous avez le choix dans la date' )
|
->setDescription( 'Vous avez le choix dans la date' )
|
||||||
->setKind( 'date' )
|
->setKind( 'date' )
|
||||||
@ -148,11 +155,11 @@ class AppPollFixtures extends Fixture {
|
|||||||
->addChoice( $choice2 )
|
->addChoice( $choice2 )
|
||||||
->addChoice( $choice3 )
|
->addChoice( $choice3 )
|
||||||
->setModificationPolicy( 'self' );
|
->setModificationPolicy( 'self' );
|
||||||
$manager->persist( $poll );
|
$manager->persist( $pollCitronOrange );
|
||||||
|
|
||||||
// poll with cartoon choices
|
// poll with cartoon choices
|
||||||
$poll = new Poll();
|
$pollCitronOrange = new Poll();
|
||||||
$poll->setTitle( 'dessin animé préféré' )
|
$pollCitronOrange->setTitle( 'dessin animé préféré' )
|
||||||
->setCustomUrl('dessin-anime')
|
->setCustomUrl('dessin-anime')
|
||||||
->setDescription( 'choisissez votre animé préféré' )
|
->setDescription( 'choisissez votre animé préféré' )
|
||||||
->setOwner( $owner )
|
->setOwner( $owner )
|
||||||
@ -169,61 +176,63 @@ class AppPollFixtures extends Fixture {
|
|||||||
|
|
||||||
$someoneComment = new Comment();
|
$someoneComment = new Comment();
|
||||||
$someoneComment
|
$someoneComment
|
||||||
|
->setPseudo('un gens qui commente')
|
||||||
->setText( "allez boumbo!" )
|
->setText( "allez boumbo!" )
|
||||||
->setOwner( $commenterMan );
|
->setOwner( $commenterMan );
|
||||||
$poll->addComment( $someoneComment );
|
$pollCitronOrange->addComment( $someoneComment );
|
||||||
$someoneComment2 = new Comment();
|
$someoneComment2 = new Comment();
|
||||||
$someoneComment2
|
$someoneComment2
|
||||||
|
->setPseudo('un gens qui commente')
|
||||||
->setText( "je suis pour la team rocket de digimon" )
|
->setText( "je suis pour la team rocket de digimon" )
|
||||||
->setOwner( $owner );
|
->setOwner( $owner );
|
||||||
$poll->addComment( $someoneComment2 );
|
$pollCitronOrange->addComment( $someoneComment2 );
|
||||||
|
|
||||||
$manager->persist( $poll );
|
$manager->persist( $pollCitronOrange );
|
||||||
|
|
||||||
$stack = new StackOfVotes();
|
$stack = new StackOfVotes();
|
||||||
$stack->setPseudo( 'Wulfila' );
|
$stack->setPseudo( 'Wulfila' );
|
||||||
$stack
|
$stack
|
||||||
->setPoll( $poll )
|
->setPoll( $pollCitronOrange )
|
||||||
->setOwner( $voter );
|
->setOwner( $voter );
|
||||||
|
|
||||||
$vote = new Vote();
|
$vote = new Vote();
|
||||||
$vote
|
$vote
|
||||||
->setPoll( $poll )
|
->setPoll( $pollCitronOrange )
|
||||||
->setStacksOfVotes( $stack )
|
->setStacksOfVotes( $stack )
|
||||||
->setValue( "yes" )
|
->setValue( "yes" )
|
||||||
->setChoice( $poll->getChoices()[ 2 ] );
|
->setChoice( $pollCitronOrange->getChoices()[ 2 ] );
|
||||||
$vote = new Vote();
|
$vote = new Vote();
|
||||||
$vote
|
$vote
|
||||||
->setPoll( $poll )
|
->setPoll( $pollCitronOrange )
|
||||||
->setStacksOfVotes( $stack )
|
->setStacksOfVotes( $stack )
|
||||||
->setValue( "maybe" )
|
->setValue( "maybe" )
|
||||||
->setChoice( $poll->getChoices()[ 1 ] );
|
->setChoice( $pollCitronOrange->getChoices()[ 1 ] );
|
||||||
|
|
||||||
$manager->persist( $stack );
|
$manager->persist( $stack );
|
||||||
|
|
||||||
$stack = new StackOfVotes();
|
$stack = new StackOfVotes();
|
||||||
$stack->setPseudo( 'Tykayn' );
|
$stack->setPseudo( 'Tykayn' );
|
||||||
$stack
|
$stack
|
||||||
->setPoll( $poll )
|
->setPoll( $pollCitronOrange )
|
||||||
->setOwner( $voter );
|
->setOwner( $voter );
|
||||||
$vote = new Vote();
|
$vote = new Vote();
|
||||||
$vote
|
$vote
|
||||||
->setPoll( $poll )
|
->setPoll( $pollCitronOrange )
|
||||||
->setStacksOfVotes( $stack )
|
->setStacksOfVotes( $stack )
|
||||||
->setValue( "yes" )
|
->setValue( "yes" )
|
||||||
->setChoice( $poll->getChoices()[ 1 ] );
|
->setChoice( $pollCitronOrange->getChoices()[ 1 ] );
|
||||||
$vote = new Vote();
|
$vote = new Vote();
|
||||||
$vote
|
$vote
|
||||||
->setPoll( $poll )
|
->setPoll( $pollCitronOrange )
|
||||||
->setStacksOfVotes( $stack )
|
->setStacksOfVotes( $stack )
|
||||||
->setValue( "yes" )
|
->setValue( "yes" )
|
||||||
->setChoice( $poll->getChoices()[ 2 ] );
|
->setChoice( $pollCitronOrange->getChoices()[ 2 ] );
|
||||||
$vote = new Vote();
|
$vote = new Vote();
|
||||||
$vote
|
$vote
|
||||||
->setPoll( $poll )
|
->setPoll( $pollCitronOrange )
|
||||||
->setStacksOfVotes( $stack )
|
->setStacksOfVotes( $stack )
|
||||||
->setValue( "no" )
|
->setValue( "no" )
|
||||||
->setChoice( $poll->getChoices()[ 2 ] );
|
->setChoice( $pollCitronOrange->getChoices()[ 2 ] );
|
||||||
|
|
||||||
$manager->persist( $stack );
|
$manager->persist( $stack );
|
||||||
|
|
||||||
|
@ -6,9 +6,16 @@ use App\Entity\Comment;
|
|||||||
use App\Entity\Owner;
|
use App\Entity\Owner;
|
||||||
use App\Entity\Poll;
|
use App\Entity\Poll;
|
||||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||||
use Doctrine\Common\Persistence\ObjectManager;
|
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
||||||
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
|
||||||
|
class CommentFixtures extends Fixture implements DependentFixtureInterface {
|
||||||
|
public function getDependencies() {
|
||||||
|
return [
|
||||||
|
AppPollFixtures::class,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
class CommentFixtures extends Fixture {
|
|
||||||
public function load( ObjectManager $manager ) {
|
public function load( ObjectManager $manager ) {
|
||||||
$emPoll = $manager->getRepository( Poll::class );
|
$emPoll = $manager->getRepository( Poll::class );
|
||||||
|
|
||||||
@ -20,9 +27,10 @@ class CommentFixtures extends Fixture {
|
|||||||
->setPseudo( 'Wulfila' );
|
->setPseudo( 'Wulfila' );
|
||||||
|
|
||||||
// comment on "citron ou orange"
|
// comment on "citron ou orange"
|
||||||
$pollCitronOrange = $emPoll->find( 1 );
|
$pollCitronOrange = $this->getReference( AppPollFixtures::POLL_FIXTURE_ONE );
|
||||||
$comment = new Comment();
|
$comment = new Comment();
|
||||||
$comment->setOwner( $commenterMan )
|
$comment->setOwner( $commenterMan )
|
||||||
|
->setPseudo( 'the indécis people' )
|
||||||
->setText( 'quelle indécision wololo! finalement citron. heu non orange. AAAAh!' );
|
->setText( 'quelle indécision wololo! finalement citron. heu non orange. AAAAh!' );
|
||||||
$pollCitronOrange->addComment( $comment );
|
$pollCitronOrange->addComment( $comment );
|
||||||
$manager->persist( $comment );
|
$manager->persist( $comment );
|
||||||
@ -31,46 +39,51 @@ class CommentFixtures extends Fixture {
|
|||||||
$manager->flush();
|
$manager->flush();
|
||||||
|
|
||||||
// comment on "démo sondage de texte avec deux commentaires"
|
// comment on "démo sondage de texte avec deux commentaires"
|
||||||
$poll = $emPoll->find( 2 );
|
// $poll = $emPoll->find( 2 );
|
||||||
$comment = new Comment();
|
// $comment = new Comment();
|
||||||
$comment->setOwner( $commenterMan2 )
|
// $comment->setOwner( $commenterMan2 )
|
||||||
->setText( 'il est écrit Squalala.' );
|
// ->setPseudo( 'The Hayroule king' )
|
||||||
$pollCitronOrange->addComment( $comment );
|
// ->setText( 'il est écrit Squalala.' );
|
||||||
$manager->persist( $comment );
|
// $pollCitronOrange->addComment( $comment );
|
||||||
$manager->persist( $poll );
|
// $manager->persist( $comment );
|
||||||
$manager->persist( $commenterMan2 );
|
// $manager->persist( $poll );
|
||||||
$manager->flush();
|
// $manager->persist( $commenterMan2 );
|
||||||
|
// $manager->flush();
|
||||||
|
//
|
||||||
|
// $comment = new Comment();
|
||||||
|
// $comment->setOwner( $commenterMan )
|
||||||
|
// ->setPseudo( 'The Hayroule king' )
|
||||||
|
// ->setText( "Zelda. Orange." );
|
||||||
|
// $pollCitronOrange->addComment( $comment );
|
||||||
|
// $manager->persist( $comment );
|
||||||
|
// $manager->persist( $poll );
|
||||||
|
// $manager->persist( $commenterMan );
|
||||||
|
// $manager->flush();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// // comment on "c'est pour aujourdhui ou pour demain"
|
||||||
|
// $poll = $emPoll->find( 3 );
|
||||||
|
// $comment = new Comment();
|
||||||
|
// $comment->setOwner( $commenterMan )
|
||||||
|
// ->setPseudo( 'The Hayroule king' )
|
||||||
|
// ->setText( "va pour demain" );
|
||||||
|
// $pollCitronOrange->addComment( $comment );
|
||||||
|
// $manager->persist( $comment );
|
||||||
|
// $manager->persist( $poll );
|
||||||
|
// $manager->persist( $commenterMan );
|
||||||
|
// $manager->flush();
|
||||||
|
//
|
||||||
|
// // comment on "dessin animé préféré"
|
||||||
|
// $poll = $emPoll->find( 4 );
|
||||||
|
// $comment = new Comment();
|
||||||
|
// $comment->setOwner( $commenterMan2 )
|
||||||
|
// ->setPseudo( 'The Hayroule king' )
|
||||||
|
// ->setText( "Ceci est un commentaire de fixture créé avec le CipherBliss poweur." );
|
||||||
|
// $pollCitronOrange->addComment( $comment );
|
||||||
|
// $manager->persist( $comment );
|
||||||
|
// $manager->persist( $poll );
|
||||||
|
// $manager->persist( $commenterMan2 );
|
||||||
|
|
||||||
$comment = new Comment();
|
|
||||||
$comment->setOwner( $commenterMan )
|
|
||||||
->setText( "Zelda. Orange." );
|
|
||||||
$pollCitronOrange->addComment( $comment );
|
|
||||||
$manager->persist( $comment );
|
|
||||||
$manager->persist( $poll );
|
|
||||||
$manager->persist( $commenterMan );
|
|
||||||
$manager->flush();
|
|
||||||
|
|
||||||
|
|
||||||
// comment on "c'est pour aujourdhui ou pour demain"
|
|
||||||
$poll = $emPoll->find( 3 );
|
|
||||||
$comment = new Comment();
|
|
||||||
$comment->setOwner( $commenterMan )
|
|
||||||
->setText( "va pour demain" );
|
|
||||||
$pollCitronOrange->addComment( $comment );
|
|
||||||
$manager->persist( $comment );
|
|
||||||
$manager->persist( $poll );
|
|
||||||
$manager->persist( $commenterMan );
|
|
||||||
$manager->flush();
|
|
||||||
|
|
||||||
// comment on "dessin animé préféré"
|
|
||||||
$poll = $emPoll->find( 4 );
|
|
||||||
$comment = new Comment();
|
|
||||||
$comment->setOwner( $commenterMan2 )
|
|
||||||
->setText( "Ceci est un commentaire de fixture créé avec le CipherBliss poweur." );
|
|
||||||
$pollCitronOrange->addComment( $comment );
|
|
||||||
$manager->persist( $comment );
|
|
||||||
$manager->persist( $poll );
|
|
||||||
$manager->persist( $commenterMan2 );
|
|
||||||
$manager->flush();
|
$manager->flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,18 @@ use App\Entity\Poll;
|
|||||||
use App\Entity\StackOfVotes;
|
use App\Entity\StackOfVotes;
|
||||||
use App\Entity\Vote;
|
use App\Entity\Vote;
|
||||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||||
use Doctrine\Common\Persistence\ObjectManager;
|
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
||||||
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
|
||||||
|
class VotesStacksFixtures extends Fixture implements DependentFixtureInterface {
|
||||||
|
public function getDependencies()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
AppPollFixtures::class,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
class VotesStacksFixtures extends Fixture {
|
|
||||||
public function load( ObjectManager $manager ) {
|
public function load( ObjectManager $manager ) {
|
||||||
$emPoll = $manager->getRepository( Poll::class );
|
|
||||||
|
|
||||||
$people1 = new Owner();
|
$people1 = new Owner();
|
||||||
$people1->setEmail( 'tktest_nikolas_edison@tktest.com' )
|
$people1->setEmail( 'tktest_nikolas_edison@tktest.com' )
|
||||||
@ -24,124 +31,127 @@ class VotesStacksFixtures extends Fixture {
|
|||||||
->setPseudo( 'Billie Jean' );
|
->setPseudo( 'Billie Jean' );
|
||||||
|
|
||||||
// "citron ou orange"
|
// "citron ou orange"
|
||||||
$poll = $emPoll->find( 1 );
|
// add vote stacks on "citron ou orange"
|
||||||
|
$pollCitronOrange = $this->getReference(AppPollFixtures::POLL_FIXTURE_ONE);
|
||||||
$stack1 = new StackOfVotes();
|
$stack1 = new StackOfVotes();
|
||||||
$stack1
|
$stack1
|
||||||
->setPoll( $poll )
|
->setPoll( $pollCitronOrange )
|
||||||
->setOwner( $people1 );
|
->setOwner( $people1 );
|
||||||
$voteA = new Vote();
|
$voteA = new Vote();
|
||||||
$voteA
|
$voteA
|
||||||
->setPoll( $poll )
|
->setPoll( $pollCitronOrange )
|
||||||
->setStacksOfVotes( $stack1 )
|
->setStacksOfVotes( $stack1 )
|
||||||
->setValue( "yes" )
|
->setValue( "yes" )
|
||||||
->setChoice( $poll->getChoices()[ 0 ] );
|
->setChoice( $pollCitronOrange->getChoices()[ 0 ] );
|
||||||
$voteB = new Vote();
|
$voteB = new Vote();
|
||||||
$voteB
|
$voteB
|
||||||
->setPoll( $poll )
|
->setPoll( $pollCitronOrange )
|
||||||
->setStacksOfVotes( $stack1 )
|
->setStacksOfVotes( $stack1 )
|
||||||
->setValue( "maybe" )
|
->setValue( "maybe" )
|
||||||
->setChoice( $poll->getChoices()[ 1 ] );
|
->setChoice( $pollCitronOrange->getChoices()[ 1 ] );
|
||||||
$poll->addStackOfVote( $stack1 );
|
$pollCitronOrange->addStackOfVote( $stack1 );
|
||||||
$manager->persist( $poll );
|
$manager->persist( $pollCitronOrange );
|
||||||
$manager->persist( $people1 );
|
$manager->persist( $people1 );
|
||||||
$manager->persist( $stack1 );
|
$manager->persist( $stack1 );
|
||||||
|
|
||||||
$stack2 = new StackOfVotes();
|
$stack2 = new StackOfVotes();
|
||||||
$stack2
|
$stack2
|
||||||
->setPoll( $poll )
|
->setPoll( $pollCitronOrange )
|
||||||
->setOwner( $people2 );
|
->setOwner( $people2 );
|
||||||
$voteA = new Vote();
|
$voteA = new Vote();
|
||||||
$voteA
|
$voteA
|
||||||
->setPoll( $poll )
|
->setPoll( $pollCitronOrange )
|
||||||
->setStacksOfVotes( $stack2 )
|
->setStacksOfVotes( $stack2 )
|
||||||
->setValue( "no" )
|
->setValue( "no" )
|
||||||
->setChoice( $poll->getChoices()[ 0 ] );
|
->setChoice( $pollCitronOrange->getChoices()[ 0 ] );
|
||||||
$voteB = new Vote();
|
$voteB = new Vote();
|
||||||
$voteB
|
$voteB
|
||||||
->setPoll( $poll )
|
->setPoll( $pollCitronOrange )
|
||||||
->setStacksOfVotes( $stack2 )
|
->setStacksOfVotes( $stack2 )
|
||||||
->setValue( "yes" )
|
->setValue( "yes" )
|
||||||
->setChoice( $poll->getChoices()[ 1 ] );
|
->setChoice( $pollCitronOrange->getChoices()[ 1 ] );
|
||||||
$poll->addStackOfVote( $stack2 );
|
$pollCitronOrange->addStackOfVote( $stack2 );
|
||||||
$manager->persist( $poll );
|
$manager->persist( $pollCitronOrange );
|
||||||
$manager->persist( $stack2 );
|
$manager->persist( $stack2 );
|
||||||
$manager->persist( $people2 );
|
$manager->persist( $people2 );
|
||||||
|
|
||||||
|
|
||||||
|
// $stack1 = new StackOfVotes();
|
||||||
|
// $stack1
|
||||||
|
// ->setPoll( $pollCitronOrange )
|
||||||
|
// ->setOwner( $people1 );
|
||||||
|
// $voteA = new Vote();
|
||||||
|
// $voteA
|
||||||
|
// ->setPoll( $pollCitronOrange )
|
||||||
|
// ->setStacksOfVotes( $stack1 )
|
||||||
|
// ->setValue( "maybe" )
|
||||||
|
// ->setChoice( $pollCitronOrange->getChoices()[ 2 ] );
|
||||||
|
// $voteB = new Vote();
|
||||||
|
// $voteB
|
||||||
|
// ->setPoll( $pollCitronOrange )
|
||||||
|
// ->setStacksOfVotes( $stack1 )
|
||||||
|
// ->setValue( "maybe" )
|
||||||
|
// ->setChoice( $pollCitronOrange->getChoices()[ 4 ] );
|
||||||
|
// $pollCitronOrange->addStackOfVote( $stack1 );
|
||||||
|
// $manager->persist( $pollCitronOrange );
|
||||||
|
// $manager->persist( $people1 );
|
||||||
|
// $manager->persist( $stack1 );
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// $stack2 = new StackOfVotes();
|
||||||
|
// $stack2
|
||||||
|
// ->setPoll( $pollCitronOrange )
|
||||||
|
// ->setOwner( $people2 );
|
||||||
|
// $voteA = new Vote();
|
||||||
|
// $voteA
|
||||||
|
// ->setPoll( $pollCitronOrange )
|
||||||
|
// ->setStacksOfVotes( $stack2 )
|
||||||
|
// ->setValue( "maybe" )
|
||||||
|
// ->setChoice( $pollCitronOrange->getChoices()[ 3 ] );
|
||||||
|
// $voteB = new Vote();
|
||||||
|
// $voteB
|
||||||
|
// ->setPoll( $pollCitronOrange )
|
||||||
|
// ->setStacksOfVotes( $stack2 )
|
||||||
|
// ->setValue( "yes" )
|
||||||
|
// ->setChoice( $pollCitronOrange->getChoices()[ 5 ] );
|
||||||
|
// $pollCitronOrange->addStackOfVote( $stack2 );
|
||||||
|
// $manager->persist( $pollCitronOrange );
|
||||||
|
// $manager->persist( $people2 );
|
||||||
|
// $manager->persist( $stack2 );
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// $stack3 = new StackOfVotes();
|
||||||
|
// $stack3
|
||||||
|
// ->setPoll( $pollCitronOrange )
|
||||||
|
// ->setOwner( $people3 );
|
||||||
|
// $voteA = new Vote();
|
||||||
|
// $voteA
|
||||||
|
// ->setPoll( $pollCitronOrange )
|
||||||
|
// ->setStacksOfVotes( $stack3 )
|
||||||
|
// ->setValue( "yes" )
|
||||||
|
// ->setChoice( $pollCitronOrange->getChoices()[ 1 ] );
|
||||||
|
// $voteB = new Vote();
|
||||||
|
// $voteB
|
||||||
|
// ->setPoll( $pollCitronOrange )
|
||||||
|
// ->setStacksOfVotes( $stack3 )
|
||||||
|
// ->setValue( "yes" )
|
||||||
|
// ->setChoice( $pollCitronOrange->getChoices()[ 3 ] );
|
||||||
|
// $pollCitronOrange->addStackOfVote( $stack3 );
|
||||||
|
// $manager->persist( $pollCitronOrange );
|
||||||
|
// $manager->persist( $people3 );
|
||||||
|
// $manager->persist( $stack3 );
|
||||||
|
|
||||||
|
|
||||||
// comment on "démo sondage de texte avec deux commentaires"
|
// comment on "démo sondage de texte avec deux commentaires"
|
||||||
$poll = $emPoll->find( 2 );
|
// $poll = $emPoll->find( 2 );
|
||||||
|
//
|
||||||
|
//
|
||||||
// comment on "c'est pour aujourdhui ou pour demain"
|
// // comment on "c'est pour aujourdhui ou pour demain"
|
||||||
$poll = $emPoll->find( 3 );
|
// $poll = $emPoll->find( 3 );
|
||||||
|
//
|
||||||
|
//
|
||||||
// comment on "dessin animé préféré"
|
// // comment on "dessin animé préféré"
|
||||||
$poll = $emPoll->find( 4 );
|
// $poll = $emPoll->find( 4 );
|
||||||
|
|
||||||
$stack1 = new StackOfVotes();
|
|
||||||
$stack1
|
|
||||||
->setPoll( $poll )
|
|
||||||
->setOwner( $people1 );
|
|
||||||
$voteA = new Vote();
|
|
||||||
$voteA
|
|
||||||
->setPoll( $poll )
|
|
||||||
->setStacksOfVotes( $stack1 )
|
|
||||||
->setValue( "maybe" )
|
|
||||||
->setChoice( $poll->getChoices()[ 2 ] );
|
|
||||||
$voteB = new Vote();
|
|
||||||
$voteB
|
|
||||||
->setPoll( $poll )
|
|
||||||
->setStacksOfVotes( $stack1 )
|
|
||||||
->setValue( "maybe" )
|
|
||||||
->setChoice( $poll->getChoices()[ 4 ] );
|
|
||||||
$poll->addStackOfVote( $stack1 );
|
|
||||||
$manager->persist( $poll );
|
|
||||||
$manager->persist( $people1 );
|
|
||||||
$manager->persist( $stack1 );
|
|
||||||
|
|
||||||
|
|
||||||
$stack2 = new StackOfVotes();
|
|
||||||
$stack2
|
|
||||||
->setPoll( $poll )
|
|
||||||
->setOwner( $people2 );
|
|
||||||
$voteA = new Vote();
|
|
||||||
$voteA
|
|
||||||
->setPoll( $poll )
|
|
||||||
->setStacksOfVotes( $stack2 )
|
|
||||||
->setValue( "maybe" )
|
|
||||||
->setChoice( $poll->getChoices()[ 3 ] );
|
|
||||||
$voteB = new Vote();
|
|
||||||
$voteB
|
|
||||||
->setPoll( $poll )
|
|
||||||
->setStacksOfVotes( $stack2 )
|
|
||||||
->setValue( "yes" )
|
|
||||||
->setChoice( $poll->getChoices()[ 5 ] );
|
|
||||||
$poll->addStackOfVote( $stack2 );
|
|
||||||
$manager->persist( $poll );
|
|
||||||
$manager->persist( $people2 );
|
|
||||||
$manager->persist( $stack2 );
|
|
||||||
|
|
||||||
|
|
||||||
$stack3 = new StackOfVotes();
|
|
||||||
$stack3
|
|
||||||
->setPoll( $poll )
|
|
||||||
->setOwner( $people3 );
|
|
||||||
$voteA = new Vote();
|
|
||||||
$voteA
|
|
||||||
->setPoll( $poll )
|
|
||||||
->setStacksOfVotes( $stack3 )
|
|
||||||
->setValue( "yes" )
|
|
||||||
->setChoice( $poll->getChoices()[ 1 ] );
|
|
||||||
$voteB = new Vote();
|
|
||||||
$voteB
|
|
||||||
->setPoll( $poll )
|
|
||||||
->setStacksOfVotes( $stack3 )
|
|
||||||
->setValue( "yes" )
|
|
||||||
->setChoice( $poll->getChoices()[ 3 ] );
|
|
||||||
$poll->addStackOfVote( $stack3 );
|
|
||||||
$manager->persist( $poll );
|
|
||||||
$manager->persist( $people3 );
|
|
||||||
$manager->persist( $stack3 );
|
|
||||||
|
|
||||||
$manager->flush();
|
$manager->flush();
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ class Poll {
|
|||||||
*/
|
*/
|
||||||
public $title;
|
public $title;
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="string", length=255, nullable=true)
|
* @ORM\Column(type="string", length=255, nullable=false, unique=true)
|
||||||
* @Serializer\Expose()
|
* @Serializer\Expose()
|
||||||
* @Serializer\Type("string")
|
* @Serializer\Type("string")
|
||||||
*/
|
*/
|
||||||
|
15
symfony.lock
15
symfony.lock
@ -23,6 +23,9 @@
|
|||||||
"doctrine/common": {
|
"doctrine/common": {
|
||||||
"version": "3.1.2"
|
"version": "3.1.2"
|
||||||
},
|
},
|
||||||
|
"doctrine/data-fixtures": {
|
||||||
|
"version": "1.5.0"
|
||||||
|
},
|
||||||
"doctrine/dbal": {
|
"doctrine/dbal": {
|
||||||
"version": "2.13.0"
|
"version": "2.13.0"
|
||||||
},
|
},
|
||||||
@ -45,6 +48,18 @@
|
|||||||
"src/Repository/.gitignore"
|
"src/Repository/.gitignore"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"doctrine/doctrine-fixtures-bundle": {
|
||||||
|
"version": "3.0",
|
||||||
|
"recipe": {
|
||||||
|
"repo": "github.com/symfony/recipes",
|
||||||
|
"branch": "master",
|
||||||
|
"version": "3.0",
|
||||||
|
"ref": "e5b542d4ef47d8a003c91beb35650c76907f7e53"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"src/DataFixtures/AppFixtures.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
"doctrine/doctrine-migrations-bundle": {
|
"doctrine/doctrine-migrations-bundle": {
|
||||||
"version": "3.1",
|
"version": "3.1",
|
||||||
"recipe": {
|
"recipe": {
|
||||||
|
Loading…
Reference in New Issue
Block a user