Add isSecret field to Event entity for hidden-when-online events
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,7 @@ final class Version20260320104445 extends AbstractMigration
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE event (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, title VARCHAR(255) NOT NULL, start_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, end_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, description TEXT DEFAULT NULL, address VARCHAR(255) NOT NULL, zipcode VARCHAR(10) NOT NULL, city VARCHAR(255) NOT NULL, event_main_picture_name VARCHAR(255) DEFAULT NULL, is_online BOOLEAN NOT NULL DEFAULT false, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, account_id INT NOT NULL, PRIMARY KEY (id))');
|
||||
$this->addSql('CREATE TABLE event (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, title VARCHAR(255) NOT NULL, start_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, end_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, description TEXT DEFAULT NULL, address VARCHAR(255) NOT NULL, zipcode VARCHAR(10) NOT NULL, city VARCHAR(255) NOT NULL, event_main_picture_name VARCHAR(255) DEFAULT NULL, is_online BOOLEAN NOT NULL DEFAULT false, is_secret BOOLEAN NOT NULL DEFAULT false, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, account_id INT NOT NULL, PRIMARY KEY (id))');
|
||||
$this->addSql('CREATE INDEX IDX_3BAE0AA79B6B5FBA ON event (account_id)');
|
||||
$this->addSql('ALTER TABLE event ADD CONSTRAINT FK_3BAE0AA79B6B5FBA FOREIGN KEY (account_id) REFERENCES "user" (id) NOT DEFERRABLE');
|
||||
}
|
||||
|
||||
@@ -50,6 +50,9 @@ class Event
|
||||
#[ORM\Column]
|
||||
private bool $isOnline = false;
|
||||
|
||||
#[ORM\Column]
|
||||
private bool $isSecret = false;
|
||||
|
||||
#[ORM\Column]
|
||||
private \DateTimeImmutable $createdAt;
|
||||
|
||||
@@ -174,6 +177,18 @@ class Event
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isSecret(): bool
|
||||
{
|
||||
return $this->isSecret;
|
||||
}
|
||||
|
||||
public function setIsSecret(bool $isSecret): static
|
||||
{
|
||||
$this->isSecret = $isSecret;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEventMainPictureFile(): ?File
|
||||
{
|
||||
return $this->eventMainPictureFile;
|
||||
|
||||
@@ -144,6 +144,21 @@ class EventTest extends TestCase
|
||||
self::assertSame($event, $result);
|
||||
}
|
||||
|
||||
public function testIsSecretDefaultFalse(): void
|
||||
{
|
||||
$event = new Event();
|
||||
self::assertFalse($event->isSecret());
|
||||
}
|
||||
|
||||
public function testSetAndGetIsSecret(): void
|
||||
{
|
||||
$event = new Event();
|
||||
$result = $event->setIsSecret(true);
|
||||
|
||||
self::assertTrue($event->isSecret());
|
||||
self::assertSame($event, $result);
|
||||
}
|
||||
|
||||
public function testSetEventMainPictureFileNullDoesNotUpdateTimestamp(): void
|
||||
{
|
||||
$event = new Event();
|
||||
|
||||
Reference in New Issue
Block a user