")
+ */
+ public $comments;
+ /**
+ * vote restricted by a password in md5 format
+ * @ORM\Column(type="string", length=255, nullable=true)
+ */
+ private $password;
+ /**
+ * used to allow administration
+ * @ORM\Column(type="string", length=255)
+ * @Serializer\Type("string")
+ */
+ private $adminKey;
+
+ /**
+ * number of days from now for default expiracy date
+ * @var int
+ * @Serializer\Expose()
+ */
+ public $defaultExpiracyDaysFromNow = 60;
+ private $maxChoicesLimit = 25;
+
+ public function computeAnswers() {
+ // counts each number of answer for this choice
+ $computedArray = [];
+ $maxScore = 0;
+
+ foreach ( $this->getStacksOfVotes() as $stack_of_vote ) {
+ foreach ( $stack_of_vote->getVotes() as $vote ) {
+ $answer = $vote->getValue();
+ $choice_id = $vote->getChoice()->getId();
+
+ if ( ! isset( $computedArray[ $choice_id ] ) ) {
+ $computedArray[ $choice_id ] = [
+ 'choice_id' => $choice_id,
+ 'choice_text' => $vote->getChoice()->getName(),
+ 'id' => $vote->getId(),
+ 'score' => 0,
+ 'yes' => [
+ 'count' => 0,
+ 'people' => [],
+ ],
+ 'maybe' => [
+ 'count' => 0,
+ 'people' => [],
+ ],
+ 'no' => [
+ 'count' => 0,
+ 'people' => [],
+ ],
+ ];
}
- }
+ $computedArray[ $choice_id ][ $answer ][ 'count' ] ++;
+ $computedArray[ $choice_id ][ $answer ][ 'people' ][] = $stack_of_vote->getOwner()->getPseudo();
- return [
- 'counts' => $computedArray,
- 'maxScore' => $maxScore,
- ];
+ if ( $answer == 'yes' ) {
+ $computedArray[ $choice_id ][ 'score' ] += 1;
+ } elseif ( $answer == 'maybe' ) {
+ $computedArray[ $choice_id ][ 'score' ] += 0.5;
+ }
+ // compare with max value
+ if ( $computedArray[ $choice_id ][ 'score' ] > $maxScore ) {
+ $maxScore = $computedArray[ $choice_id ][ 'score' ];
+ }
+ }
}
- public function display() {
- return [
- 'poll' => $this,
- 'answers' => $this->computeAnswers(),
- ];
- }
+ return [
+ 'counts' => $computedArray,
+ 'maxScore' => $maxScore,
+ ];
+ }
- public function __construct() {
- $this->votes = new ArrayCollection();
- $this->stacksOfVotes = new ArrayCollection();
- $this->choices = new ArrayCollection();
- $this->comments = new ArrayCollection();
- $this->initiate();
- }
+ public function display() {
+ return [
+ 'poll' => $this,
+ 'answers' => $this->computeAnswers(),
+ ];
+ }
+ public function __construct() {
+ $this->votes = new ArrayCollection();
+ $this->stacksOfVotes = new ArrayCollection();
+ $this->choices = new ArrayCollection();
+ $this->comments = new ArrayCollection();
+ $this->initiate();
+ }
- private function initiate() {
- $this->adminKey = $this->generateAdminKey();
- $this->setCreationDate( new \DateTime() );
- $this->setExpiracyDate( $this->addDaysToDate(
- new \DateTime(),
- $this->defaultExpiracyDaysFromNow
- ) );
- $this->setAllowedAnswers( [ 'yes' ] );
- }
+ private function initiate() {
+ $this->adminKey = $this->generateAdminKey();
+ $this->setCreationDate( new \DateTime() );
+ $this->setExpiracyDate( $this->addDaysToDate(
+ new \DateTime(),
+ $this->defaultExpiracyDaysFromNow
+ ) );
+ $this->setAllowedAnswers( [ 'yes' ] );
+ }
- public function generateAdminKey() {
- $rand = random_int( PHP_INT_MIN, PHP_INT_MAX );
- return str_shuffle( md5( $rand ) . $rand . $this->random_str() );
- }
+ public function generateAdminKey() {
+ $rand = random_int( PHP_INT_MIN, PHP_INT_MAX );
- /**
- * Generate a random string, using a cryptographically secure
- * pseudorandom number generator (random_int)
- *
- * This function uses type hints now (PHP 7+ only), but it was originally
- * written for PHP 5 as well.
- *
- * For PHP 7, random_int is a PHP core function
- * For PHP 5.x, depends on https://github.com/paragonie/random_compat
- *
- * @param int $length How many characters do we want?
- * @param string $keyspace A string of all possible characters
- * to select from
- *
- * @return string
- */
- public function random_str(
- int $length = 64,
- string $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
- ): string {
- if ( $length < 1 ) {
- throw new \RangeException( "Length must be a positive integer" );
- }
- $pieces = [];
- $max = mb_strlen( $keyspace, '8bit' ) - 1;
- for ( $i = 0 ; $i < $length ; ++ $i ) {
- $pieces [] = $keyspace[ random_int( 0, $max ) ];
- }
+ return str_shuffle( md5( $rand ) . $rand . $this->random_str() );
+ }
- return implode( '', $pieces );
+ /**
+ * Generate a random string, using a cryptographically secure
+ * pseudorandom number generator (random_int)
+ *
+ * This function uses type hints now (PHP 7+ only), but it was originally
+ * written for PHP 5 as well.
+ *
+ * For PHP 7, random_int is a PHP core function
+ * For PHP 5.x, depends on https://github.com/paragonie/random_compat
+ *
+ * @param int $length How many characters do we want?
+ * @param string $keyspace A string of all possible characters
+ * to select from
+ *
+ * @return string
+ */
+ public function random_str(
+ int $length = 64,
+ string $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ ): string {
+ if ( $length < 1 ) {
+ throw new \RangeException( "Length must be a positive integer" );
+ }
+ $pieces = [];
+ $max = mb_strlen( $keyspace, '8bit' ) - 1;
+ for ( $i = 0 ; $i < $length ; ++ $i ) {
+ $pieces [] = $keyspace[ random_int( 0, $max ) ];
}
- public function findChoiceById( int $id ) {
+ return implode( '', $pieces );
+ }
- $choices = $this->getChoices();
- $counter = 0;
- // there must be something cleaner than this in Doctrine ArrayCollection
- foreach ( $choices as $choice ) {
- $counter ++;
- if ( $counter > $this->maxChoicesLimit ) {
- throw new \ErrorException( "max number of choices reached for this poll" );
- }
- if ( $choice && $choice->getId() == $id ) {
- return $choice;
- }
+ public function findChoiceById( int $id ) {
+ $choices = $this->getChoices();
+ $counter = 0;
+ // there must be something cleaner than this in Doctrine ArrayCollection
+ foreach ( $choices as $choice ) {
+ $counter ++;
+ if ( $counter > $this->maxChoicesLimit ) {
+ throw new \ErrorException( "max number of choices reached for this poll" );
+ }
+ if ( $choice && $choice->getId() == $id ) {
+ return $choice;
}
- return null;
}
- public function addDaysToDate( \DateTime $date, int $days ) {
- $st = strtotime( $date->getTimestamp() . ' + ' . $days . ' days' );
+ return null;
+ }
- return new \DateTime( $st );
- }
+ public function addDaysToDate( \DateTime $date, int $days ) {
+ $st = strtotime( $date->getTimestamp() . ' + ' . $days . ' days' );
- public function getId(): ?int {
- return $this->id;
- }
+ return new \DateTime( $st );
+ }
- public function getTitle(): ?string {
- return $this->title;
- }
+ public function getId(): ?int {
+ return $this->id;
+ }
- public function setTitle( string $title ): self {
- $this->title = $title;
+ public function getTitle(): ?string {
+ return $this->title;
+ }
- return $this;
- }
+ public function setTitle( string $title ): self {
+ $this->title = $title;
- public function getCreationDate(): ?DateTimeInterface {
- return $this->creationDate;
- }
+ return $this;
+ }
- public function setCreationDate( DateTimeInterface $creationDate ): self {
- $this->creationDate = $creationDate;
+ public function getCreationDate(): ?DateTimeInterface {
+ return $this->creationDate;
+ }
- return $this;
- }
+ public function setCreationDate( DateTimeInterface $creationDate ): self {
+ $this->creationDate = $creationDate;
- public function setExpiracyDate( DateTimeInterface $expiracyDate ): self {
- $this->expiracyDate = $expiracyDate;
+ return $this;
+ }
- return $this;
- }
+ public function setExpiracyDate( DateTimeInterface $expiracyDate ): self {
+ $this->expiracyDate = $expiracyDate;
- public function getOwner(): ?Owner {
- return $this->owner;
- }
+ return $this;
+ }
- public function setOwner( ?Owner $owner ): self {
- $this->owner = $owner;
+ public function getOwner(): ?Owner {
+ return $this->owner;
+ }
- return $this;
- }
+ public function setOwner( ?Owner $owner ): self {
+ $this->owner = $owner;
- /**
- * @return Collection|Vote[]
- */
- public function getVotes(): Collection {
- return $this->votes;
- }
+ return $this;
+ }
+ /**
+ * @return Collection|Vote[]
+ */
+ public function getVotes(): Collection {
+ return $this->votes;
+ }
- public function getAdminKey(): ?string {
- return $this->adminKey;
- }
- public function setAdminKey( string $adminKey ): self {
- $this->adminKey = $adminKey;
+ public function getAdminKey(): ?string {
+ return $this->adminKey;
+ }
- return $this;
- }
+ public function setAdminKey( string $adminKey ): self {
+ $this->adminKey = $adminKey;
- public function getDescription(): ?string {
- return $this->description;
- }
+ return $this;
+ }
- public function setDescription( string $description ): self {
- $this->description = $description;
+ public function getDescription(): ?string {
+ return $this->description;
+ }
- return $this;
- }
+ public function setDescription( string $description ): self {
+ $this->description = $description;
- public function getKind(): ?string {
- return $this->kind;
- }
+ return $this;
+ }
- public function setKind( string $kind ): self {
- $this->kind = $kind;
+ public function getKind(): ?string {
+ return $this->kind;
+ }
- return $this;
- }
+ public function setKind( string $kind ): self {
+ $this->kind = $kind;
- public function getCustomUrl(): ?string {
- return $this->customUrl;
- }
+ return $this;
+ }
- public function setCustomUrl( string $customUrl ): self {
- $this->customUrl = $customUrl;
+ public function getCustomUrl(): ?string {
+ return $this->customUrl;
+ }
- return $this;
- }
+ public function setCustomUrl( string $customUrl ): self {
+ $this->customUrl = $customUrl;
- public function getPassword(): ?string {
- return $this->password;
- }
+ return $this;
+ }
- public function setPassword( string $password ): self {
- $this->password = md5( $password );
+ public function getPassword(): ?string {
+ return $this->password;
+ }
- return $this;
- }
+ public function setPassword( string $password ): self {
+ $this->password = md5( $password );
- public function getModificationPolicy(): ?string {
- return $this->modificationPolicy;
- }
+ return $this;
+ }
- public function setModificationPolicy( string $modificationPolicy ): self {
- $this->modificationPolicy = $modificationPolicy;
+ public function getModificationPolicy(): ?string {
+ return $this->modificationPolicy;
+ }
- return $this;
- }
+ public function setModificationPolicy( string $modificationPolicy ): self {
+ $this->modificationPolicy = $modificationPolicy;
- public function getMailOnComment(): ?bool {
- return $this->mailOnComment;
- }
+ return $this;
+ }
- public function setMailOnComment( bool $mailOnComment ): self {
- $this->mailOnComment = $mailOnComment;
+ public function getMailOnComment(): ?bool {
+ return $this->mailOnComment;
+ }
- return $this;
- }
+ public function setMailOnComment( bool $mailOnComment ): self {
+ $this->mailOnComment = $mailOnComment;
- public function getMailOnVote(): ?bool {
- return $this->mailOnVote;
- }
+ return $this;
+ }
- public function setMailOnVote( bool $mailOnVote ): self {
- $this->mailOnVote = $mailOnVote;
+ public function getMailOnVote(): ?bool {
+ return $this->mailOnVote;
+ }
- return $this;
- }
+ public function setMailOnVote( bool $mailOnVote ): self {
+ $this->mailOnVote = $mailOnVote;
- public function getHideResults(): ?bool {
- return $this->hideResults;
- }
+ return $this;
+ }
- public function setHideResults( bool $hideResults ): self {
- $this->hideResults = $hideResults;
+ public function getHideResults(): ?bool {
+ return $this->hideResults;
+ }
- return $this;
- }
+ public function setHideResults( bool $hideResults ): self {
+ $this->hideResults = $hideResults;
- public function getShowResultEvenIfPasswords(): ?bool {
- return $this->showResultEvenIfPasswords;
- }
+ return $this;
+ }
- public function setShowResultEvenIfPasswords( bool $showResultEvenIfPasswords ): self {
- $this->showResultEvenIfPasswords = $showResultEvenIfPasswords;
+ public function getShowResultEvenIfPasswords(): ?bool {
+ return $this->showResultEvenIfPasswords;
+ }
- return $this;
- }
+ public function setShowResultEvenIfPasswords( bool $showResultEvenIfPasswords ): self {
+ $this->showResultEvenIfPasswords = $showResultEvenIfPasswords;
+ return $this;
+ }
- /**
- * @return Collection|Comment[]
- */
- public function getComments(): Collection {
- return $this->comments;
- }
- public function addComment( Comment $comment ): self {
- if ( ! $this->comments->contains( $comment ) ) {
- $this->comments[] = $comment;
- $comment->setPoll( $this );
- }
+ /**
+ * @return Collection|Comment[]
+ */
+ public function getComments(): Collection {
+ return $this->comments;
+ }
- return $this;
+ public function addComment( Comment $comment ): self {
+ if ( ! $this->comments->contains( $comment ) ) {
+ $this->comments[] = $comment;
+ $comment->setPoll( $this );
}
- public function removeComment( Comment $comment ): self {
- if ( $this->comments->contains( $comment ) ) {
- $this->comments->removeElement( $comment );
- // set the owning side to null (unless already changed)
- if ( $comment->getPoll() === $this ) {
- $comment->setPoll( null );
- }
- }
+ return $this;
+ }
- return $this;
+ public function removeComment( Comment $comment ): self {
+ if ( $this->comments->contains( $comment ) ) {
+ $this->comments->removeElement( $comment );
+ // set the owning side to null (unless already changed)
+ if ( $comment->getPoll() === $this ) {
+ $comment->setPoll( null );
+ }
}
- public function getStacksOfVotes() {
- return $this->stacksOfVotes;
- }
+ return $this;
+ }
- public function setStacksOfVotes( ?StackOfVotes $stacksOfVotes ): self {
- $this->stacksOfVotes = $stacksOfVotes;
+ public function getStacksOfVotes() {
+ return $this->stacksOfVotes;
+ }
- return $this;
- }
+ public function setStacksOfVotes( ?StackOfVotes $stacksOfVotes ): self {
+ $this->stacksOfVotes = $stacksOfVotes;
+ return $this;
+ }
- public function addStackOfVote( StackOfVotes $stackOfVote ): self {
- if ( ! $this->stacksOfVotes->contains( $stackOfVote ) ) {
- $this->stacksOfVotes[] = $stackOfVote;
- $stackOfVote->setPoll( $this );
- }
- return $this;
+ public function addStackOfVote( StackOfVotes $stackOfVote ): self {
+ if ( ! $this->stacksOfVotes->contains( $stackOfVote ) ) {
+ $this->stacksOfVotes[] = $stackOfVote;
+ $stackOfVote->setPoll( $this );
}
- public function removeStackOfVote( StackOfVotes $stackOfVote ): self {
- if ( $this->stacksOfVotes->contains( $stackOfVote ) ) {
- $this->stacksOfVotes->removeElement( $stackOfVote );
- // set the owning side to null (unless already changed)
- if ( $stackOfVote->getPoll() === $this ) {
- $stackOfVote->setPoll( null );
- }
- }
+ return $this;
+ }
- return $this;
+ public function removeStackOfVote( StackOfVotes $stackOfVote ): self {
+ if ( $this->stacksOfVotes->contains( $stackOfVote ) ) {
+ $this->stacksOfVotes->removeElement( $stackOfVote );
+ // set the owning side to null (unless already changed)
+ if ( $stackOfVote->getPoll() === $this ) {
+ $stackOfVote->setPoll( null );
+ }
}
- public function getExpiracyDate(): ?\DateTimeInterface {
- return $this->expiracyDate;
- }
+ return $this;
+ }
- public function addVote( Vote $vote ): self {
- if ( ! $this->votes->contains( $vote ) ) {
- $this->votes[] = $vote;
- $vote->setPoll( $this );
- }
+ public function getExpiracyDate(): ?\DateTimeInterface {
+ return $this->expiracyDate;
+ }
- return $this;
+ public function addVote( Vote $vote ): self {
+ if ( ! $this->votes->contains( $vote ) ) {
+ $this->votes[] = $vote;
+ $vote->setPoll( $this );
}
- public function removeVote( Vote $vote ): self {
- if ( $this->votes->contains( $vote ) ) {
- $this->votes->removeElement( $vote );
- // set the owning side to null (unless already changed)
- if ( $vote->getPoll() === $this ) {
- $vote->setPoll( null );
- }
- }
+ return $this;
+ }
- return $this;
+ public function removeVote( Vote $vote ): self {
+ if ( $this->votes->contains( $vote ) ) {
+ $this->votes->removeElement( $vote );
+ // set the owning side to null (unless already changed)
+ if ( $vote->getPoll() === $this ) {
+ $vote->setPoll( null );
+ }
}
- /**
- * @return Collection|Choice[]
- */
- public function getChoices(): Collection {
- return $this->choices;
- }
+ return $this;
+ }
- public function addTextChoiceArray( Array $choiceTextArray ): self {
- foreach ( $choiceTextArray as $text ) {
- $newChoice = new Choice();
- $newChoice->setName( $text );
- $this->addChoice( $newChoice );
- }
+ /**
+ * @return Collection|Choice[]
+ */
+ public function getChoices(): Collection {
+ return $this->choices;
+ }
- return $this;
+ public function addTextChoiceArray( array $choiceTextArray ): self {
+ foreach ( $choiceTextArray as $text ) {
+ $newChoice = new Choice();
+ $newChoice->setName( $text );
+ $this->addChoice( $newChoice );
}
+ return $this;
+ }
- public function getAllowedAnswers(): ?array {
- return $this->allowedAnswers;
- }
- public function setAllowedAnswers( array $allowedAnswers ): self {
- $this->allowedAnswers = $allowedAnswers;
+ public function getAllowedAnswers(): ?array {
+ return $this->allowedAnswers;
+ }
- return $this;
- }
+ public function setAllowedAnswers( array $allowedAnswers ): self {
+ $this->allowedAnswers = $allowedAnswers;
- public function addStacksOfVote( StackOfVotes $stacksOfVote ): self {
- if ( ! $this->stacksOfVotes->contains( $stacksOfVote ) ) {
- $this->stacksOfVotes[] = $stacksOfVote;
- $stacksOfVote->setPoll( $this );
- }
+ return $this;
+ }
- return $this;
+ public function addStacksOfVote( StackOfVotes $stacksOfVote ): self {
+ if ( ! $this->stacksOfVotes->contains( $stacksOfVote ) ) {
+ $this->stacksOfVotes[] = $stacksOfVote;
+ $stacksOfVote->setPoll( $this );
}
- public function removeStacksOfVote( StackOfVotes $stacksOfVote ): self {
- if ( $this->stacksOfVotes->contains( $stacksOfVote ) ) {
- $this->stacksOfVotes->removeElement( $stacksOfVote );
- // set the owning side to null (unless already changed)
- if ( $stacksOfVote->getPoll() === $this ) {
- $stacksOfVote->setPoll( null );
- }
- }
+ return $this;
+ }
- return $this;
+ public function removeStacksOfVote( StackOfVotes $stacksOfVote ): self {
+ if ( $this->stacksOfVotes->contains( $stacksOfVote ) ) {
+ $this->stacksOfVotes->removeElement( $stacksOfVote );
+ // set the owning side to null (unless already changed)
+ if ( $stacksOfVote->getPoll() === $this ) {
+ $stacksOfVote->setPoll( null );
+ }
}
- public function addChoice( Choice $choice ): self {
- if ( ! is_null( $this->choices ) ) {
- if ( ! $this->choices->contains( $choice ) ) {
- $this->choices[] = $choice;
- $choice->setPoll( $this );
- }
- } else {
+ return $this;
+ }
+
+ public function addChoice( Choice $choice ): self {
+ if ( ! is_null( $this->choices ) ) {
+ if ( ! $this->choices->contains( $choice ) ) {
$this->choices[] = $choice;
$choice->setPoll( $this );
}
+ } else {
+ $this->choices[] = $choice;
+ $choice->setPoll( $this );
+ }
- return $this;
- }
+ return $this;
+ }
- public function removeChoice( Choice $choice ): self {
- if ( $this->choices->contains( $choice ) ) {
- $this->choices->removeElement( $choice );
- // set the owning side to null (unless already changed)
- if ( $choice->getPoll() === $this ) {
- $choice->setPoll( null );
- }
+ public function removeChoice( Choice $choice ): self {
+ if ( $this->choices->contains( $choice ) ) {
+ $this->choices->removeElement( $choice );
+ // set the owning side to null (unless already changed)
+ if ( $choice->getPoll() === $this ) {
+ $choice->setPoll( null );
}
-
- return $this;
}
+
+ return $this;
+ }
+
+ public function getVotesAllowed(): ?bool {
+ return $this->votesAllowed;
+ }
+
+ public function setVotesAllowed( ?bool $votesAllowed ): self {
+ $this->votesAllowed = $votesAllowed;
+
+ return $this;
+ }
+
+ public function getVotesMax() {
+ return $this->votesMax;
+ }
+
+ public function setVotesMax( $votesMax ): self {
+ $this->votesMax = $votesMax;
+
+ return $this;
+ }
+
+ public function getChoicesMax() {
+ return $this->choicesMax;
+ }
+
+ public function setChoicesMax( $choicesMax ): self {
+ $this->choicesMax = $choicesMax;
+
+ return $this;
+ }
+
+ public function getCommentsAllowed(): ?bool {
+ return $this->commentsAllowed;
+ }
+
+ public function setCommentsAllowed( ?bool $commentsAllowed ): self {
+ $this->commentsAllowed = $commentsAllowed;
+
+ return $this;
}
+}
diff --git a/src/Kernel.php b/src/Kernel.php
old mode 100755
new mode 100644
index 785b0be..655e796
--- a/src/Kernel.php
+++ b/src/Kernel.php
@@ -3,51 +3,36 @@
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
-use Symfony\Component\Config\Loader\LoaderInterface;
-use Symfony\Component\Config\Resource\FileResource;
-use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
-use Symfony\Component\Routing\RouteCollectionBuilder;
+use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
class Kernel extends BaseKernel
{
use MicroKernelTrait;
- private const CONFIG_EXTS = '.{php,xml,yaml,yml}';
-
- public function registerBundles(): iterable
+ protected function configureContainer(ContainerConfigurator $container): void
{
- $contents = require $this->getProjectDir().'/config/bundles.php';
- foreach ($contents as $class => $envs) {
- if ($envs[$this->environment] ?? $envs['all'] ?? false) {
- yield new $class();
- }
+ $container->import('../config/{packages}/*.yaml');
+ $container->import('../config/{packages}/'.$this->environment.'/*.yaml');
+
+ if (is_file(\dirname(__DIR__).'/config/services.yaml')) {
+ $container->import('../config/services.yaml');
+ $container->import('../config/{services}_'.$this->environment.'.yaml');
+ } elseif (is_file($path = \dirname(__DIR__).'/config/services.php')) {
+ (require $path)($container->withPath($path), $this);
}
}
- public function getProjectDir(): string
+ protected function configureRoutes(RoutingConfigurator $routes): void
{
- return \dirname(__DIR__);
- }
+ $routes->import('../config/{routes}/'.$this->environment.'/*.yaml');
+ $routes->import('../config/{routes}/*.yaml');
- protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
- {
- $container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
- $container->setParameter('container.dumper.inline_class_loader', true);
- $confDir = $this->getProjectDir().'/config';
-
- $loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
- $loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob');
- $loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
- $loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
- }
-
- protected function configureRoutes(RouteCollectionBuilder $routes): void
- {
- $confDir = $this->getProjectDir().'/config';
-
- $routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob');
- $routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
- $routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
+ if (is_file(\dirname(__DIR__).'/config/routes.yaml')) {
+ $routes->import('../config/routes.yaml');
+ } elseif (is_file($path = \dirname(__DIR__).'/config/routes.php')) {
+ (require $path)($routes->withPath($path), $this);
+ }
}
}
diff --git a/src/Repository/.gitignore b/src/Repository/.gitignore
old mode 100755
new mode 100644
diff --git a/src/Repository/PollRepository.php b/src/Repository/PollRepository.php
index 6762cad..d090fa5 100755
--- a/src/Repository/PollRepository.php
+++ b/src/Repository/PollRepository.php
@@ -4,7 +4,8 @@ namespace App\Repository;
use App\Entity\Poll;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
-use Doctrine\Common\Persistence\ManagerRegistry;
+use Doctrine\Persistence\ManagerRegistry;
+use MongoDB\Driver\Manager;
/**
* @method Poll|null find($id, $lockMode = null, $lockVersion = null)
@@ -14,7 +15,8 @@ use Doctrine\Common\Persistence\ManagerRegistry;
*/
class PollRepository extends ServiceEntityRepository
{
- public function __construct(ManagerRegistry $registry)
+ public function __construct(ManagerRegistry
+ $registry)
{
parent::__construct($registry, Poll::class);
}
diff --git a/symfony.lock b/symfony.lock
old mode 100755
new mode 100644
index 7923095..d874e2e
--- a/symfony.lock
+++ b/symfony.lock
@@ -8,96 +8,85 @@
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
- "ref": "cb4152ebcadbe620ea2261da1a1c5a9b8cea7672"
+ "ref": "a2759dd6123694c8d901d0ec80006e044c2e6457"
},
"files": [
"config/routes/annotations.yaml"
]
},
"doctrine/cache": {
- "version": "v1.8.0"
+ "version": "1.10.2"
},
"doctrine/collections": {
- "version": "v1.6.2"
+ "version": "1.6.7"
},
"doctrine/common": {
- "version": "v2.11.0"
- },
- "doctrine/data-fixtures": {
- "version": "v1.3.2"
+ "version": "3.1.2"
},
"doctrine/dbal": {
- "version": "v2.9.2"
+ "version": "2.13.0"
+ },
+ "doctrine/deprecations": {
+ "version": "v0.5.3"
},
"doctrine/doctrine-bundle": {
- "version": "1.6",
+ "version": "2.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
- "version": "1.6",
- "ref": "05802762c395b1e9f0f2645ebbd6128a87942f09"
+ "version": "2.3",
+ "ref": "9777bf185961283a450b6237281132935025fe04"
},
"files": [
"config/packages/doctrine.yaml",
"config/packages/prod/doctrine.yaml",
+ "config/packages/test/doctrine.yaml",
"src/Entity/.gitignore",
"src/Repository/.gitignore"
]
},
- "doctrine/doctrine-fixtures-bundle": {
- "version": "3.0",
- "recipe": {
- "repo": "github.com/symfony/recipes",
- "branch": "master",
- "version": "3.0",
- "ref": "fc52d86631a6dfd9fdf3381d0b7e3df2069e51b3"
- },
- "files": [
- "src/DataFixtures/AppFixtures.php"
- ]
- },
"doctrine/doctrine-migrations-bundle": {
- "version": "1.2",
+ "version": "3.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
- "version": "1.2",
- "ref": "c1431086fec31f17fbcfe6d6d7e92059458facc1"
+ "version": "3.1",
+ "ref": "ee609429c9ee23e22d6fa5728211768f51ed2818"
},
"files": [
"config/packages/doctrine_migrations.yaml",
- "src/Migrations/.gitignore"
+ "migrations/.gitignore"
]
},
"doctrine/event-manager": {
- "version": "v1.0.0"
+ "version": "1.1.1"
},
"doctrine/inflector": {
- "version": "v1.3.0"
+ "version": "2.0.3"
},
"doctrine/instantiator": {
- "version": "1.2.0"
+ "version": "1.4.0"
},
"doctrine/lexer": {
- "version": "1.1.0"
+ "version": "1.2.1"
},
"doctrine/migrations": {
- "version": "2.1.1"
+ "version": "3.1.1"
},
"doctrine/orm": {
- "version": "v2.6.4"
+ "version": "2.8.4"
},
"doctrine/persistence": {
- "version": "1.1.1"
- },
- "doctrine/reflection": {
- "version": "v1.0.0"
+ "version": "2.1.0"
},
"doctrine/sql-formatter": {
"version": "1.1.1"
},
"egulias/email-validator": {
- "version": "2.1.15"
+ "version": "3.1.1"
+ },
+ "friendsofphp/proxy-manager-lts": {
+ "version": "v1.0.3"
},
"friendsofsymfony/rest-bundle": {
"version": "2.2",
@@ -112,10 +101,10 @@
]
},
"jms/metadata": {
- "version": "2.1.0"
+ "version": "2.5.0"
},
"jms/serializer": {
- "version": "3.3.0"
+ "version": "3.12.2"
},
"jms/serializer-bundle": {
"version": "3.0",
@@ -132,85 +121,31 @@
]
},
"laminas/laminas-code": {
- "version": "3.4.1"
+ "version": "4.1.0"
},
"laminas/laminas-eventmanager": {
- "version": "3.3.0"
+ "version": "3.3.1"
},
"laminas/laminas-zendframework-bridge": {
- "version": "1.1.1"
- },
- "liip/test-fixtures-bundle": {
- "version": "1.8.0"
- },
- "nelmio/api-doc-bundle": {
- "version": "3.0",
- "recipe": {
- "repo": "github.com/symfony/recipes-contrib",
- "branch": "master",
- "version": "3.0",
- "ref": "c8e0c38e1a280ab9e37587a8fa32b251d5bc1c94"
- },
- "files": [
- "config/packages/nelmio_api_doc.yaml",
- "config/routes/nelmio_api_doc.yaml"
- ]
- },
- "nelmio/cors-bundle": {
- "version": "1.5",
- "recipe": {
- "repo": "github.com/symfony/recipes",
- "branch": "master",
- "version": "1.5",
- "ref": "6388de23860284db9acce0a7a5d9d13153bcb571"
- },
- "files": [
- "config/packages/nelmio_cors.yaml"
- ]
+ "version": "1.2.0"
},
"nikic/php-parser": {
- "version": "v4.2.4"
- },
- "ocramius/package-versions": {
- "version": "1.4.0"
- },
- "ocramius/proxy-manager": {
- "version": "2.2.3"
- },
- "overblog/graphql-bundle": {
- "version": "0.12",
- "recipe": {
- "repo": "github.com/symfony/recipes-contrib",
- "branch": "master",
- "version": "0.12",
- "ref": "c01dcfb85a6e93f1a43ef36151fcff11cf17f791"
- },
- "files": [
- "config/graphql/types/.gitignore",
- "config/packages/graphql.yaml",
- "config/routes/graphql.yaml"
- ]
- },
- "php": {
- "version": "7.4"
+ "version": "v4.10.4"
},
- "phpdocumentor/reflection-common": {
- "version": "2.0.0"
- },
- "phpdocumentor/reflection-docblock": {
- "version": "4.3.2"
- },
- "phpdocumentor/type-resolver": {
- "version": "1.0.1"
+ "phpstan/phpdoc-parser": {
+ "version": "0.4.14"
},
"psr/cache": {
- "version": "1.0.1"
+ "version": "2.0.0"
},
"psr/container": {
+ "version": "1.1.1"
+ },
+ "psr/event-dispatcher": {
"version": "1.0.0"
},
"psr/log": {
- "version": "1.1.0"
+ "version": "1.1.3"
},
"sensio/framework-extra-bundle": {
"version": "5.2",
@@ -225,68 +160,58 @@
]
},
"swiftmailer/swiftmailer": {
- "version": "v6.2.3"
+ "version": "v6.2.7"
},
"symfony/asset": {
- "version": "v4.3.11"
- },
- "symfony/browser-kit": {
- "version": "v4.3.11"
+ "version": "v5.2.4"
},
"symfony/cache": {
- "version": "v4.3.5"
+ "version": "v5.2.6"
},
"symfony/cache-contracts": {
- "version": "v1.1.7"
+ "version": "2.4-dev"
},
"symfony/config": {
- "version": "v4.3.5"
+ "version": "v5.2.4"
},
"symfony/console": {
- "version": "3.3",
+ "version": "5.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
- "version": "3.3",
- "ref": "482d233eb8de91ebd042992077bbd5838858890c"
+ "version": "5.1",
+ "ref": "c6d02bdfba9da13c22157520e32a602dbee8a75c"
},
"files": [
- "bin/console",
- "config/bootstrap.php"
+ "bin/console"
]
},
- "symfony/debug": {
- "version": "v4.3.5"
- },
"symfony/dependency-injection": {
- "version": "v4.3.5"
+ "version": "v5.2.6"
},
"symfony/deprecation-contracts": {
"version": "v2.2.0"
},
"symfony/doctrine-bridge": {
- "version": "v4.3.5"
- },
- "symfony/dom-crawler": {
- "version": "v4.3.11"
+ "version": "v5.2.6"
},
"symfony/dotenv": {
- "version": "v4.3.5"
+ "version": "v5.2.4"
+ },
+ "symfony/error-handler": {
+ "version": "v5.2.6"
},
"symfony/event-dispatcher": {
- "version": "v4.3.5"
+ "version": "v5.2.4"
},
"symfony/event-dispatcher-contracts": {
- "version": "v1.1.7"
- },
- "symfony/expression-language": {
- "version": "v4.3.11"
+ "version": "v2.2.0"
},
"symfony/filesystem": {
- "version": "v4.3.5"
+ "version": "v5.2.6"
},
"symfony/finder": {
- "version": "v4.3.5"
+ "version": "v5.2.4"
},
"symfony/flex": {
"version": "1.0",
@@ -294,57 +219,46 @@
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
- "ref": "19fa03bacd9a6619583d1e4939da4388df22984d"
+ "ref": "c0eeb50665f0f77226616b6038a9b06c03752d8e"
},
"files": [
".env"
]
},
"symfony/form": {
- "version": "v4.3.5"
+ "version": "v5.2.6"
},
"symfony/framework-bundle": {
- "version": "4.2",
+ "version": "5.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
- "version": "4.2",
- "ref": "61ad963f28c091b8bb9449507654b9c7d8bbb53c"
+ "version": "5.2",
+ "ref": "6ec87563dcc85cd0c48856dcfbfc29610506d250"
},
"files": [
- "config/bootstrap.php",
"config/packages/cache.yaml",
"config/packages/framework.yaml",
"config/packages/test/framework.yaml",
+ "config/preload.php",
+ "config/routes/dev/framework.yaml",
"config/services.yaml",
"public/index.php",
"src/Controller/.gitignore",
"src/Kernel.php"
]
},
+ "symfony/http-client-contracts": {
+ "version": "v2.3.1"
+ },
"symfony/http-foundation": {
- "version": "v4.3.5"
+ "version": "v5.2.4"
},
"symfony/http-kernel": {
- "version": "v4.3.5"
- },
- "symfony/inflector": {
- "version": "v4.3.5"
+ "version": "v5.2.6"
},
"symfony/intl": {
- "version": "v4.3.5"
- },
- "symfony/mailer": {
- "version": "4.3",
- "recipe": {
- "repo": "github.com/symfony/recipes",
- "branch": "master",
- "version": "4.3",
- "ref": "15658c2a0176cda2e7dba66276a2030b52bd81b2"
- },
- "files": [
- "config/packages/mailer.yaml"
- ]
+ "version": "v5.2.4"
},
"symfony/maker-bundle": {
"version": "1.0",
@@ -355,64 +269,49 @@
"ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f"
}
},
- "symfony/mime": {
- "version": "v4.3.5"
- },
"symfony/options-resolver": {
- "version": "v4.3.5"
+ "version": "v5.2.4"
},
"symfony/orm-pack": {
- "version": "v1.0.7"
+ "version": "v2.1.0"
},
- "symfony/phpunit-bridge": {
- "version": "4.3",
- "recipe": {
- "repo": "github.com/symfony/recipes",
- "branch": "master",
- "version": "4.3",
- "ref": "6d0e35f749d5f4bfe1f011762875275cd3f9874f"
- },
- "files": [
- ".env.test",
- "bin/phpunit",
- "phpunit.xml.dist",
- "tests/bootstrap.php"
- ]
+ "symfony/polyfill-intl-grapheme": {
+ "version": "v1.22.1"
},
"symfony/polyfill-intl-icu": {
- "version": "v1.12.0"
+ "version": "v1.22.1"
},
"symfony/polyfill-intl-idn": {
- "version": "v1.12.0"
+ "version": "v1.22.1"
},
"symfony/polyfill-intl-normalizer": {
- "version": "v1.20.0"
+ "version": "v1.22.1"
},
"symfony/polyfill-mbstring": {
- "version": "v1.12.0"
- },
- "symfony/polyfill-php72": {
- "version": "v1.12.0"
+ "version": "v1.22.1"
},
"symfony/polyfill-php73": {
- "version": "v1.12.0"
+ "version": "v1.22.1"
},
- "symfony/process": {
- "version": "v4.3.6"
+ "symfony/polyfill-php80": {
+ "version": "v1.22.1"
},
"symfony/property-access": {
- "version": "v4.3.5"
+ "version": "v5.2.4"
},
"symfony/property-info": {
- "version": "v4.3.6"
+ "version": "v5.2.4"
+ },
+ "symfony/proxy-manager-bridge": {
+ "version": "v5.2.4"
},
"symfony/routing": {
- "version": "4.2",
+ "version": "5.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
- "version": "4.2",
- "ref": "683dcb08707ba8d41b7e34adb0344bfd68d248a7"
+ "version": "5.1",
+ "ref": "b4f3e7c95e38b606eef467e8a42a8408fc460c43"
},
"files": [
"config/packages/prod/routing.yaml",
@@ -421,16 +320,16 @@
]
},
"symfony/security-core": {
- "version": "v4.3.5"
- },
- "symfony/security-csrf": {
- "version": "v4.3.11"
+ "version": "v5.2.6"
},
"symfony/service-contracts": {
- "version": "v1.1.7"
+ "version": "v2.2.0"
},
"symfony/stopwatch": {
- "version": "v4.3.5"
+ "version": "v5.2.4"
+ },
+ "symfony/string": {
+ "version": "v5.2.6"
},
"symfony/swiftmailer-bundle": {
"version": "2.5",
@@ -447,98 +346,41 @@
]
},
"symfony/translation-contracts": {
- "version": "v1.1.7"
+ "version": "v2.3.0"
},
"symfony/twig-bridge": {
- "version": "v4.3.10"
+ "version": "v5.2.6"
},
"symfony/twig-bundle": {
- "version": "3.3",
+ "version": "5.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
- "version": "3.3",
- "ref": "1da1987340b5ba64b16383906d678b989e3d096e"
+ "version": "5.0",
+ "ref": "fab9149bbaa4d5eca054ed93f9e1b66cc500895d"
},
"files": [
"config/packages/test/twig.yaml",
"config/packages/twig.yaml",
- "config/routes/dev/twig.yaml",
"templates/base.html.twig"
]
},
- "symfony/validator": {
- "version": "4.3",
- "recipe": {
- "repo": "github.com/symfony/recipes",
- "branch": "master",
- "version": "4.3",
- "ref": "d902da3e4952f18d3bf05aab29512eb61cabd869"
- },
- "files": [
- "config/packages/test/validator.yaml",
- "config/packages/validator.yaml"
- ]
+ "symfony/var-dumper": {
+ "version": "v5.2.6"
},
"symfony/var-exporter": {
- "version": "v4.3.5"
- },
- "symfony/web-server-bundle": {
- "version": "3.3",
- "recipe": {
- "repo": "github.com/symfony/recipes",
- "branch": "master",
- "version": "3.3",
- "ref": "dae9b39fd6717970be7601101ce5aa960bf53d9a"
- }
- },
- "symfony/webpack-encore-bundle": {
- "version": "1.6",
- "recipe": {
- "repo": "github.com/symfony/recipes",
- "branch": "master",
- "version": "1.6",
- "ref": "69e1d805ad95964088bd510c05995e87dc391564"
- },
- "files": [
- "assets/app.js",
- "assets/styles/app.css",
- "config/packages/assets.yaml",
- "config/packages/prod/webpack_encore.yaml",
- "config/packages/test/webpack_encore.yaml",
- "config/packages/webpack_encore.yaml",
- "package.json",
- "webpack.config.js"
- ]
+ "version": "v5.2.4"
},
"symfony/yaml": {
- "version": "v4.3.5"
+ "version": "v5.2.5"
},
"twig/twig": {
- "version": "v2.12.3"
- },
- "webimpress/safe-writer": {
- "version": "2.1.0"
- },
- "webmozart/assert": {
- "version": "1.5.0"
- },
- "webonyx/graphql-php": {
- "version": "v0.13.9"
+ "version": "v3.3.0"
},
"willdurand/jsonp-callback-validator": {
"version": "v1.1.0"
},
"willdurand/negotiation": {
- "version": "v2.3.1"
- },
- "zendframework/zend-code": {
- "version": "3.4.0"
- },
- "zendframework/zend-eventmanager": {
- "version": "3.2.1"
- },
- "zircote/swagger-php": {
- "version": "2.0.14"
+ "version": "3.0.0"
}
}
diff --git a/templates/admin/index.html.twig b/templates/admin/index.html.twig
new file mode 100644
index 0000000..2787881
--- /dev/null
+++ b/templates/admin/index.html.twig
@@ -0,0 +1,20 @@
+{% extends 'base.html.twig' %}
+
+{% block title %}Hello AdminController!{% endblock %}
+
+{% block body %}
+
+
+
+
Hello {{ controller_name }}! ✅
+
+ This friendly message is coming from:
+
+
+{% endblock %}
diff --git a/templates/default/index.html.twig b/templates/default/index.html.twig
new file mode 100644
index 0000000..28ad699
--- /dev/null
+++ b/templates/default/index.html.twig
@@ -0,0 +1,20 @@
+{% extends 'base.html.twig' %}
+
+{% block title %}Hello DefaultController!{% endblock %}
+
+{% block body %}
+
+
+
+
Hello {{ controller_name }}! ✅
+
+ This friendly message is coming from:
+
+
+{% endblock %}
diff --git a/templates/migration/index.html.twig b/templates/migration/index.html.twig
new file mode 100644
index 0000000..388c189
--- /dev/null
+++ b/templates/migration/index.html.twig
@@ -0,0 +1,20 @@
+{% extends 'base.html.twig' %}
+
+{% block title %}Hello MigrationController!{% endblock %}
+
+{% block body %}
+
+
+
+
Hello {{ controller_name }}! ✅
+
+ This friendly message is coming from:
+
+
+{% endblock %}
diff --git a/templates/owner/index.html.twig b/templates/owner/index.html.twig
new file mode 100644
index 0000000..42b0a54
--- /dev/null
+++ b/templates/owner/index.html.twig
@@ -0,0 +1,20 @@
+{% extends 'base.html.twig' %}
+
+{% block title %}Hello OwnerController!{% endblock %}
+
+{% block body %}
+
+
+
+
Hello {{ controller_name }}! ✅
+
+ This friendly message is coming from:
+
+
+{% endblock %}
diff --git a/templates/pages/funky.html.twig b/templates/pages/funky.html.twig
new file mode 100644
index 0000000..af88fcf
--- /dev/null
+++ b/templates/pages/funky.html.twig
@@ -0,0 +1,14 @@
+{% extends 'base.html.twig' %}
+{% block outerBody %}
+
+ Bienvenue à la maison!
+
+{% endblock %}
diff --git a/templates/pages/migration.html.twig b/templates/pages/migration.html.twig
new file mode 100644
index 0000000..9a6f2c9
--- /dev/null
+++ b/templates/pages/migration.html.twig
@@ -0,0 +1,82 @@
+{% extends 'base.html.twig' %}
+{% block title %}migration depuis un Framadate version 1{% endblock %}
+{% block body %}
+
+
+
+ 🍰 Migration des sondages depuis un Framadate version 1
+
+ Depuis la base de données
+ {{ OLD_DATABASE_NAME }}
+
+ avec l'utilisateur
+ {{ OLD_DATABASE_USER }}
+ vers la base symfony locale, telle que configurée dans le fichier .env .
+
+
+
+ 🎉 Ont été migrés:
+
+
+ 🎈 Sondages: {{ counters.polls }}
+
+
+ 🍾 stacks of vote: {{ counters.polls }}
+
+
+ 🧁 slots : {{ counters.choices }}
+
+
+ 🍰 votes : {{ counters.votes }}
+
+
+ ☕ comments : {{ counters.comments }}
+
+
+
+
+
+
+
+ Debug:
+
+ {{ debug | nl2br}}
+
+
+
+
+
+{% endblock %}
diff --git a/templates/vote/index.html.twig b/templates/vote/index.html.twig
new file mode 100644
index 0000000..472772d
--- /dev/null
+++ b/templates/vote/index.html.twig
@@ -0,0 +1,20 @@
+{% extends 'base.html.twig' %}
+
+{% block title %}Hello VoteController!{% endblock %}
+
+{% block body %}
+
+
+
+
Hello {{ controller_name }}! ✅
+
+ This friendly message is coming from:
+
+
+{% endblock %}
diff --git a/webpack.config.js b/webpack.config.js
deleted file mode 100644
index 63764c7..0000000
--- a/webpack.config.js
+++ /dev/null
@@ -1,74 +0,0 @@
-var Encore = require('@symfony/webpack-encore');
-
-// Manually configure the runtime environment if not already configured yet by the "encore" command.
-// It's useful when you use tools that rely on webpack.config.js file.
-if (!Encore.isRuntimeEnvironmentConfigured()) {
- Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
-}
-
-Encore
- // directory where compiled assets will be stored
- .setOutputPath('public/build/')
- // public path used by the web server to access the output path
- .setPublicPath('/build')
- // only needed for CDN's or sub-directory deploy
- //.setManifestKeyPrefix('build/')
-
- /*
- * ENTRY CONFIG
- *
- * Add 1 entry for each "page" of your app
- * (including one that's included on every page - e.g. "app")
- *
- * Each entry will result in one JavaScript file (e.g. app.js)
- * and one CSS file (e.g. app.css) if your JavaScript imports CSS.
- */
- .addEntry('app', './assets/app.js')
- //.addEntry('page1', './assets/page1.js')
- //.addEntry('page2', './assets/page2.js')
-
- // When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
- .splitEntryChunks()
-
- // will require an extra script tag for runtime.js
- // but, you probably want this, unless you're building a single-page app
- .enableSingleRuntimeChunk()
-
- /*
- * FEATURE CONFIG
- *
- * Enable & configure other features below. For a full
- * list of features, see:
- * https://symfony.com/doc/current/frontend.html#adding-more-features
- */
- .cleanupOutputBeforeBuild()
- .enableBuildNotifications()
- .enableSourceMaps(!Encore.isProduction())
- // enables hashed filenames (e.g. app.abc123.css)
- .enableVersioning(Encore.isProduction())
-
- // enables @babel/preset-env polyfills
- .configureBabelPresetEnv((config) => {
- config.useBuiltIns = 'usage';
- config.corejs = 3;
- })
-
- // enables Sass/SCSS support
- .enableSassLoader()
-
- // uncomment if you use TypeScript
- //.enableTypeScriptLoader()
-
- // uncomment to get integrity="..." attributes on your script & link tags
- // requires WebpackEncoreBundle 1.4 or higher
- .enableIntegrityHashes(Encore.isProduction())
-
- // uncomment if you're having problems with a jQuery plugin
- //.autoProvidejQuery()
-
- // uncomment if you use API Platform Admin (composer req api-admin)
- //.enableReactPreset()
- //.addEntry('admin', './assets/admin.js')
-;
-
-module.exports = Encore.getWebpackConfig();