Skip to content

Commit

Permalink
4
Browse files Browse the repository at this point in the history
  • Loading branch information
rimi-itk committed Feb 21, 2021
1 parent a64fce0 commit 0de6738
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
14 changes: 8 additions & 6 deletions migrations/Version20210221204057.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,22 @@
*/
final class Version20210221204057 extends AbstractMigration
{
public function getDescription() : string
public function getDescription(): string
{
return '';
return "";
}

public function up(Schema $schema) : void
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE site (host VARCHAR(255) NOT NULL, title VARCHAR(255) NOT NULL, messages_monday VARCHAR(255) NOT NULL, messages_tuesday VARCHAR(255) NOT NULL, messages_wednesday VARCHAR(255) NOT NULL, messages_thursday VARCHAR(255) NOT NULL, messages_friday VARCHAR(255) NOT NULL, messages_saturday VARCHAR(255) NOT NULL, messages_sunday VARCHAR(255) NOT NULL, PRIMARY KEY(host))');
$this->addSql(
"CREATE TABLE site (host VARCHAR(255) NOT NULL, title VARCHAR(255) NOT NULL, messages_monday VARCHAR(255) NOT NULL, messages_tuesday VARCHAR(255) NOT NULL, messages_wednesday VARCHAR(255) NOT NULL, messages_thursday VARCHAR(255) NOT NULL, messages_friday VARCHAR(255) NOT NULL, messages_saturday VARCHAR(255) NOT NULL, messages_sunday VARCHAR(255) NOT NULL, PRIMARY KEY(host))"
);
}

public function down(Schema $schema) : void
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE site');
$this->addSql("DROP TABLE site");
}
}
4 changes: 4 additions & 0 deletions src/Controller/SiteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Annotation\Route;

/**
Expand All @@ -24,6 +25,9 @@ public function index(
): Response {
$host = $request->get("host", $request->getHost());
$site = $siteRepository->findOneByHost($host);
if (null === $site) {
throw new NotFoundHttpException();
}
$now = $this->getNow($request);
$message = "";
if (null !== $site && $site->getMessages()) {
Expand Down
1 change: 1 addition & 0 deletions src/Entity/Site.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Site

/**
* @ORM\Column(type="string", length=255)
* @Assert\NotBlank()
*/
private $title;

Expand Down

0 comments on commit 0de6738

Please sign in to comment.