Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 11 additions & 29 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -4448,38 +4448,38 @@
'path' => __DIR__ . '/sources/AppBundle/Controller/Event/Speaker/SuggestionAction.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$comment of method AppBundle\\\\Event\\\\Model\\\\SpeakerSuggestion\\:\\:setComment\\(\\) expects string, mixed given\\.$#',
'message' => '#^Parameter \\#2 \\$data of method AppBundle\\\\Controller\\\\Event\\\\Speaker\\\\SuggestionAction\\:\\:createSpeakerSuggestion\\(\\) expects array, mixed given\\.$#',
'identifier' => 'argument.type',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Event/Speaker/SuggestionAction.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$eventId of method AppBundle\\\\Event\\\\Model\\\\SpeakerSuggestion\\:\\:setEventId\\(\\) expects int, int\\|null given\\.$#',
'identifier' => 'argument.type',
'message' => '#^Property AppBundle\\\\Event\\\\Entity\\\\SpeakerSuggestion\\:\\:\\$comment \\(string\\|null\\) does not accept mixed\\.$#',
'identifier' => 'assign.propertyType',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Event/Speaker/SuggestionAction.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$speakerName of method AppBundle\\\\Event\\\\Model\\\\SpeakerSuggestion\\:\\:setSpeakerName\\(\\) expects string, mixed given\\.$#',
'identifier' => 'argument.type',
'message' => '#^Property AppBundle\\\\Event\\\\Entity\\\\SpeakerSuggestion\\:\\:\\$eventId \\(int\\) does not accept int\\|null\\.$#',
'identifier' => 'assign.propertyType',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Event/Speaker/SuggestionAction.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$suggesterEmail of method AppBundle\\\\Event\\\\Model\\\\SpeakerSuggestion\\:\\:setSuggesterEmail\\(\\) expects string, mixed given\\.$#',
'identifier' => 'argument.type',
'message' => '#^Property AppBundle\\\\Event\\\\Entity\\\\SpeakerSuggestion\\:\\:\\$speakerName \\(string\\) does not accept mixed\\.$#',
'identifier' => 'assign.propertyType',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Event/Speaker/SuggestionAction.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$suggesterName of method AppBundle\\\\Event\\\\Model\\\\SpeakerSuggestion\\:\\:setSuggesterName\\(\\) expects string, mixed given\\.$#',
'identifier' => 'argument.type',
'message' => '#^Property AppBundle\\\\Event\\\\Entity\\\\SpeakerSuggestion\\:\\:\\$suggesterEmail \\(string\\) does not accept mixed\\.$#',
'identifier' => 'assign.propertyType',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Event/Speaker/SuggestionAction.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#2 \\$data of method AppBundle\\\\Controller\\\\Event\\\\Speaker\\\\SuggestionAction\\:\\:createSpeakerSuggestion\\(\\) expects array, mixed given\\.$#',
'identifier' => 'argument.type',
'message' => '#^Property AppBundle\\\\Event\\\\Entity\\\\SpeakerSuggestion\\:\\:\\$suggesterName \\(string\\) does not accept mixed\\.$#',
'identifier' => 'assign.propertyType',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Event/Speaker/SuggestionAction.php',
];
Expand Down Expand Up @@ -6631,24 +6631,6 @@
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Model/Repository/SpeakerRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Method AppBundle\\\\Event\\\\Model\\\\Repository\\\\SpeakerSuggestionRepository\\:\\:initMetadata\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#',
'identifier' => 'missingType.iterableValue',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Model/Repository/SpeakerSuggestionRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Method AppBundle\\\\Event\\\\Model\\\\Repository\\\\SpeakerSuggestionRepository\\:\\:initMetadata\\(\\) return type with generic class CCMBenchmark\\\\Ting\\\\Repository\\\\Metadata does not specify its types\\: T$#',
'identifier' => 'missingType.generics',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Model/Repository/SpeakerSuggestionRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$databaseName of method CCMBenchmark\\\\Ting\\\\Repository\\\\Metadata\\<object\\>\\:\\:setDatabase\\(\\) expects string, mixed given\\.$#',
'identifier' => 'argument.type',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Event/Model/Repository/SpeakerSuggestionRepository.php',
];
$ignoreErrors[] = [
'message' => '#^Method AppBundle\\\\Event\\\\Model\\\\Repository\\\\SponsorScanRepository\\:\\:getBySponsorTicket\\(\\) has no return type specified\\.$#',
'identifier' => 'missingType.return',
Expand Down
21 changes: 11 additions & 10 deletions sources/AppBundle/Controller/Event/Speaker/SuggestionAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
use AppBundle\Email\Mailer\MailUserFactory;
use AppBundle\Event\Form\SpeakerSuggestionType;
use AppBundle\Event\Model\Event;
use AppBundle\Event\Model\Repository\SpeakerSuggestionRepository;
use AppBundle\Event\Model\SpeakerSuggestion;
use AppBundle\Event\Entity\Repository\SpeakerSuggestionRepository;
use AppBundle\Event\Entity\SpeakerSuggestion;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -62,14 +62,15 @@ public function __invoke(Request $request, string $eventSlug): Response

private function createSpeakerSuggestion(Event $event, array $data): SpeakerSuggestion
{
return new SpeakerSuggestion()
->setEventId($event->getId())
->setSuggesterEmail($data['suggester_email'])
->setSuggesterName($data['suggester_name'])
->setSpeakerName($data['speaker_name'])
->setComment($data['comment'])
->setCreatedAt(new \DateTime('now'))
;
$speakerSuggestion = new SpeakerSuggestion();
$speakerSuggestion->eventId = $event->getId();
$speakerSuggestion->suggesterEmail = $data['suggester_email'];
$speakerSuggestion->suggesterName = $data['suggester_name'];
$speakerSuggestion->speakerName = $data['speaker_name'];
$speakerSuggestion->comment = $data['comment'];
$speakerSuggestion->createdAt = new \DateTimeImmutable('now');

return $speakerSuggestion;
}

private function sendMail(Event $event, SpeakerSuggestion $speakerSuggestion): void
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace AppBundle\Event\Entity\Repository;

use AppBundle\Doctrine\EntityRepository;
use AppBundle\Event\Entity\SpeakerSuggestion;
use Doctrine\Persistence\ManagerRegistry;

/**
* @extends EntityRepository<SpeakerSuggestion>
*/
final class SpeakerSuggestionRepository extends EntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, SpeakerSuggestion::class);
}
}
37 changes: 37 additions & 0 deletions sources/AppBundle/Event/Entity/SpeakerSuggestion.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace AppBundle\Event\Entity;

use AppBundle\Event\Entity\Repository\SpeakerSuggestionRepository;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity(repositoryClass: SpeakerSuggestionRepository::class)]
#[ORM\Table(name: 'afup_speaker_suggestion')]
class SpeakerSuggestion
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
public ?int $id = null;

#[ORM\Column(name: 'event_id', nullable: false)]
public int $eventId;

#[ORM\Column(name: 'suggester_email', length: 255, nullable: false)]
public string $suggesterEmail;

#[ORM\Column(name: 'suggester_name', length: 255, nullable: false)]
public string $suggesterName;

#[ORM\Column(name: 'speaker_name', length: 255, nullable: false)]
public string $speakerName;

#[ORM\Column(type: 'text', nullable: true)]
public ?string $comment = null;

#[ORM\Column(name: 'created_at', type: 'datetime_immutable', nullable: false)]
public DateTimeImmutable $createdAt;
}

This file was deleted.

Loading
Loading