mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-10-31 01:08:26 +00:00 
			
		
		
		
	fix cs
This commit is contained in:
		| @@ -1,5 +1,12 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * 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. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\Migrations\Activity; | ||||
| @@ -9,6 +16,11 @@ use Doctrine\Migrations\AbstractMigration; | ||||
|  | ||||
| final class Version20220527124438 extends AbstractMigration | ||||
| { | ||||
|     public function down(Schema $schema): void | ||||
|     { | ||||
|         $this->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'); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,5 +1,12 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * 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. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\Migrations\Calendar; | ||||
| @@ -9,6 +16,11 @@ use Doctrine\Migrations\AbstractMigration; | ||||
|  | ||||
| final class Version20220527124558 extends AbstractMigration | ||||
| { | ||||
|     public function down(Schema $schema): void | ||||
|     { | ||||
|         $this->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'); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -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<int, string> | ||||
|      */ | ||||
|     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(); | ||||
|   | ||||
| @@ -1,5 +1,12 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * 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. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\Migrations\Main; | ||||
| @@ -9,6 +16,10 @@ use Doctrine\Migrations\AbstractMigration; | ||||
|  | ||||
| final class Version20220513151853 extends AbstractMigration | ||||
| { | ||||
|     public function down(Schema $schema): void | ||||
|     { | ||||
|     } | ||||
|  | ||||
|     public function getDescription(): string | ||||
|     { | ||||
|         return 'set default on attributes'; | ||||
| @@ -18,9 +29,4 @@ final class Version20220513151853 extends AbstractMigration | ||||
|     { | ||||
|         $this->addSql('update users set attributes = \'[]\'::json where attributes IS NULL'); | ||||
|     } | ||||
|  | ||||
|     public function down(Schema $schema): void | ||||
|     { | ||||
|  | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,5 +1,12 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * 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. | ||||
|  */ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\Migrations\Person; | ||||
| @@ -9,6 +16,11 @@ use Doctrine\Migrations\AbstractMigration; | ||||
|  | ||||
| final class Version20220527124737 extends AbstractMigration | ||||
| { | ||||
|     public function down(Schema $schema): void | ||||
|     { | ||||
|         $this->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'); | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user