mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
fix cs
This commit is contained in:
parent
54a3e2b2ef
commit
5e5a855578
@ -1,5 +1,12 @@
|
|||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\Migrations\Activity;
|
namespace Chill\Migrations\Activity;
|
||||||
@ -9,6 +16,11 @@ use Doctrine\Migrations\AbstractMigration;
|
|||||||
|
|
||||||
final class Version20220527124438 extends 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
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return 'add private comment to activity';
|
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 \'{}\'');
|
$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
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\Migrations\Calendar;
|
namespace Chill\Migrations\Calendar;
|
||||||
@ -9,6 +16,11 @@ use Doctrine\Migrations\AbstractMigration;
|
|||||||
|
|
||||||
final class Version20220527124558 extends 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
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return 'add private comment to calendar';
|
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');
|
$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 Chill\MainBundle\Entity\User;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use function array_key_exists;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Embeddable
|
* @ORM\Embeddable
|
||||||
@ -21,6 +22,7 @@ class PrivateCommentEmbeddable
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="json", nullable=false, options={"default": "{}"})
|
* @ORM\Column(type="json", nullable=false, options={"default": "{}"})
|
||||||
|
*
|
||||||
* @var array<int, string>
|
* @var array<int, string>
|
||||||
*/
|
*/
|
||||||
private array $comments = [];
|
private array $comments = [];
|
||||||
@ -30,17 +32,17 @@ class PrivateCommentEmbeddable
|
|||||||
return $this->comments[$user->getId()] ?? '';
|
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
|
public function getComments(): ?array
|
||||||
{
|
{
|
||||||
return $this->comments;
|
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
|
public function merge(PrivateCommentEmbeddable $newComment): self
|
||||||
{
|
{
|
||||||
$currentComments = null === $this->getComments() ? [] : $this->getComments();
|
$currentComments = null === $this->getComments() ? [] : $this->getComments();
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\Migrations\Main;
|
namespace Chill\Migrations\Main;
|
||||||
@ -9,6 +16,10 @@ use Doctrine\Migrations\AbstractMigration;
|
|||||||
|
|
||||||
final class Version20220513151853 extends AbstractMigration
|
final class Version20220513151853 extends AbstractMigration
|
||||||
{
|
{
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public function getDescription(): string
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return 'set default on attributes';
|
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');
|
$this->addSql('update users set attributes = \'[]\'::json where attributes IS NULL');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(Schema $schema): void
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\Migrations\Person;
|
namespace Chill\Migrations\Person;
|
||||||
@ -9,6 +16,11 @@ use Doctrine\Migrations\AbstractMigration;
|
|||||||
|
|
||||||
final class Version20220527124737 extends AbstractMigration
|
final class Version20220527124737 extends AbstractMigration
|
||||||
{
|
{
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE activity DROP privateComment_comments');
|
||||||
|
}
|
||||||
|
|
||||||
public function getDescription(): string
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return 'add private comment on accompanying period work';
|
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 \'{}\'');
|
$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');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user