diff --git a/src/Bundle/ChillMainBundle/Entity/NewsItem.php b/src/Bundle/ChillMainBundle/Entity/NewsItem.php index aa3ded5b0..35b872c81 100644 --- a/src/Bundle/ChillMainBundle/Entity/NewsItem.php +++ b/src/Bundle/ChillMainBundle/Entity/NewsItem.php @@ -57,6 +57,15 @@ class NewsItem implements TrackCreationInterface, TrackUpdateInterface */ private string $content = ''; + /** + * @ORM\Column(type="string") + * + * @groups({"write", "read"}) + * + * @Assert\NotNull + */ + private string $type = ''; + /** * @ORM\Column(type="date_immutable", nullable=false) */ @@ -183,4 +192,16 @@ class NewsItem implements TrackCreationInterface, TrackUpdateInterface { return $this->id; } + + public function getType(): string + { + return $this->type; + } + + public function setType(string $type): self + { + $this->type = $type; + + return $this; + } } diff --git a/src/Bundle/ChillMainBundle/migrations/Version20231026091847.php b/src/Bundle/ChillMainBundle/migrations/Version20231108103723.php similarity index 74% rename from src/Bundle/ChillMainBundle/migrations/Version20231026091847.php rename to src/Bundle/ChillMainBundle/migrations/Version20231108103723.php index 1c1b3138e..f2f924bc3 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20231026091847.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20231108103723.php @@ -2,32 +2,25 @@ declare(strict_types=1); -/* - * Chill is a software for social workers - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - namespace Chill\Migrations\Main; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; /** - * Add news item entity. + * Create news item entity */ -final class Version20231026091847 extends AbstractMigration +final class Version20231108103723 extends AbstractMigration { public function getDescription(): string { - return 'Add news item entity'; + return 'Create news item entity'; } public function up(Schema $schema): void { $this->addSql('CREATE SEQUENCE chill_main_news_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE TABLE chill_main_news (id INT NOT NULL, title TEXT NOT NULL, content TEXT NOT NULL, startDate DATE NOT NULL, endDate DATE DEFAULT NULL, createdAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updatedAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, createdBy_id INT DEFAULT NULL, updatedBy_id INT DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE TABLE chill_main_news (id INT NOT NULL, title TEXT NOT NULL, content TEXT NOT NULL, type VARCHAR(255) NOT NULL, startDate DATE NOT NULL, endDate DATE DEFAULT NULL, createdAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updatedAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, createdBy_id INT DEFAULT NULL, updatedBy_id INT DEFAULT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE INDEX IDX_96922AFB3174800F ON chill_main_news (createdBy_id)'); $this->addSql('CREATE INDEX IDX_96922AFB65FF1AEC ON chill_main_news (updatedBy_id)'); $this->addSql('COMMENT ON COLUMN chill_main_news.startDate IS \'(DC2Type:date_immutable)\'');