From 5e5a8555782a4c9abc1eb5dddada107685109452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 27 May 2022 15:48:50 +0200 Subject: [PATCH] fix cs --- .../migrations/Version20220527124438.php | 17 ++++++++++++----- .../migrations/Version20220527124558.php | 17 ++++++++++++----- .../Embeddable/PrivateCommentEmbeddable.php | 14 ++++++++------ .../migrations/Version20220513151853.php | 16 +++++++++++----- .../migrations/Version20220527124737.php | 17 ++++++++++++----- 5 files changed, 55 insertions(+), 26 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/migrations/Version20220527124438.php b/src/Bundle/ChillActivityBundle/migrations/Version20220527124438.php index 1ccf3f0b3..2661edf4b 100644 --- a/src/Bundle/ChillActivityBundle/migrations/Version20220527124438.php +++ b/src/Bundle/ChillActivityBundle/migrations/Version20220527124438.php @@ -1,5 +1,12 @@ addSql('ALTER TABLE chill_person_accompanying_period_work DROP privateComment_comments'); + } + public function getDescription(): string { return 'add private comment to activity'; @@ -18,9 +30,4 @@ final class Version20220527124438 extends AbstractMigration { $this->addSql('ALTER TABLE activity ADD privateComment_comments JSON DEFAULT \'{}\''); } - - public function down(Schema $schema): void - { - $this->addSql('ALTER TABLE chill_person_accompanying_period_work DROP privateComment_comments'); - } } diff --git a/src/Bundle/ChillCalendarBundle/migrations/Version20220527124558.php b/src/Bundle/ChillCalendarBundle/migrations/Version20220527124558.php index 17c53a004..39c4cb7c3 100644 --- a/src/Bundle/ChillCalendarBundle/migrations/Version20220527124558.php +++ b/src/Bundle/ChillCalendarBundle/migrations/Version20220527124558.php @@ -1,5 +1,12 @@ addSql('ALTER TABLE chill_calendar.calendar DROP privateComment_comments'); + } + public function getDescription(): string { return 'add private comment to calendar'; @@ -18,9 +30,4 @@ final class Version20220527124558 extends AbstractMigration { $this->addSql('ALTER TABLE chill_calendar.calendar ADD privateComment_comments JSON DEFAULT NULL'); } - - public function down(Schema $schema): void - { - $this->addSql('ALTER TABLE chill_calendar.calendar DROP privateComment_comments'); - } } diff --git a/src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php b/src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php index e27e906c0..09a35324e 100644 --- a/src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php +++ b/src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php @@ -13,6 +13,7 @@ namespace Chill\MainBundle\Entity\Embeddable; use Chill\MainBundle\Entity\User; use Doctrine\ORM\Mapping as ORM; +use function array_key_exists; /** * @ORM\Embeddable @@ -21,6 +22,7 @@ class PrivateCommentEmbeddable { /** * @ORM\Column(type="json", nullable=false, options={"default": "{}"}) + * * @var array */ private array $comments = []; @@ -30,17 +32,17 @@ class PrivateCommentEmbeddable return $this->comments[$user->getId()] ?? ''; } - public function hasCommentForUser(User $user): bool - { - return array_key_exists($user->getId(), $this->comments) - && "" !== $this->comments[$user->getId()]; - } - public function getComments(): ?array { return $this->comments; } + public function hasCommentForUser(User $user): bool + { + return array_key_exists($user->getId(), $this->comments) + && '' !== $this->comments[$user->getId()]; + } + public function merge(PrivateCommentEmbeddable $newComment): self { $currentComments = null === $this->getComments() ? [] : $this->getComments(); diff --git a/src/Bundle/ChillMainBundle/migrations/Version20220513151853.php b/src/Bundle/ChillMainBundle/migrations/Version20220513151853.php index 31319ce1b..ec99ce2ba 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20220513151853.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20220513151853.php @@ -1,5 +1,12 @@ addSql('update users set attributes = \'[]\'::json where attributes IS NULL'); } - - public function down(Schema $schema): void - { - - } } diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20220527124737.php b/src/Bundle/ChillPersonBundle/migrations/Version20220527124737.php index b8f5b1dde..75b598db3 100644 --- a/src/Bundle/ChillPersonBundle/migrations/Version20220527124737.php +++ b/src/Bundle/ChillPersonBundle/migrations/Version20220527124737.php @@ -1,5 +1,12 @@ addSql('ALTER TABLE activity DROP privateComment_comments'); + } + public function getDescription(): string { return 'add private comment on accompanying period work'; @@ -18,9 +30,4 @@ final class Version20220527124737 extends AbstractMigration { $this->addSql('ALTER TABLE chill_person_accompanying_period_work ADD privateComment_comments JSON DEFAULT \'{}\''); } - - public function down(Schema $schema): void - { - $this->addSql('ALTER TABLE activity DROP privateComment_comments'); - } }