mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Remove NOT NULL constraint from created and updated properties
This commit is contained in:
parent
ebaff8d170
commit
8ab03473b7
@ -12,7 +12,9 @@ declare(strict_types=1);
|
|||||||
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||||
|
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||||
|
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
|
||||||
use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable;
|
use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable;
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodLinkedWithSocialIssuesEntityInterface;
|
use Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodLinkedWithSocialIssuesEntityInterface;
|
||||||
@ -34,6 +36,8 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
#[ORM\Table(name: 'chill_person_accompanying_period_work')]
|
#[ORM\Table(name: 'chill_person_accompanying_period_work')]
|
||||||
class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, TrackCreationInterface, TrackUpdateInterface
|
class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, TrackCreationInterface, TrackUpdateInterface
|
||||||
{
|
{
|
||||||
|
use TrackCreationTrait;
|
||||||
|
use TrackUpdateTrait;
|
||||||
#[Serializer\Groups(['read', 'read:accompanyingPeriodWork:light'])]
|
#[Serializer\Groups(['read', 'read:accompanyingPeriodWork:light'])]
|
||||||
#[ORM\ManyToOne(targetEntity: AccompanyingPeriod::class)]
|
#[ORM\ManyToOne(targetEntity: AccompanyingPeriod::class)]
|
||||||
#[Serializer\Context(normalizationContext: ['groups' => ['read']], groups: ['read:accompanyingPeriodWork:light'])]
|
#[Serializer\Context(normalizationContext: ['groups' => ['read']], groups: ['read:accompanyingPeriodWork:light'])]
|
||||||
@ -50,10 +54,6 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
|||||||
#[ORM\OrderBy(['startDate' => \Doctrine\Common\Collections\Criteria::DESC, 'id' => 'DESC'])]
|
#[ORM\OrderBy(['startDate' => \Doctrine\Common\Collections\Criteria::DESC, 'id' => 'DESC'])]
|
||||||
private Collection $accompanyingPeriodWorkEvaluations;
|
private Collection $accompanyingPeriodWorkEvaluations;
|
||||||
|
|
||||||
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
|
|
||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)]
|
|
||||||
private ?\DateTimeImmutable $createdAt = null;
|
|
||||||
|
|
||||||
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
|
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
|
||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||||
private bool $createdAutomatically = false;
|
private bool $createdAutomatically = false;
|
||||||
@ -62,11 +62,6 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
|||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||||
private string $createdAutomaticallyReason = '';
|
private string $createdAutomaticallyReason = '';
|
||||||
|
|
||||||
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
|
|
||||||
#[ORM\ManyToOne(targetEntity: User::class)]
|
|
||||||
#[ORM\JoinColumn(nullable: false)]
|
|
||||||
private ?User $createdBy = null;
|
|
||||||
|
|
||||||
#[Serializer\Groups(['accompanying_period_work:create', 'accompanying_period_work:edit', 'read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
|
#[Serializer\Groups(['accompanying_period_work:create', 'accompanying_period_work:edit', 'read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
|
||||||
#[Assert\GreaterThanOrEqual(propertyPath: 'startDate', message: 'accompanying_course_work.The endDate should be greater or equal than the start date')]
|
#[Assert\GreaterThanOrEqual(propertyPath: 'startDate', message: 'accompanying_course_work.The endDate should be greater or equal than the start date')]
|
||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
|
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
|
||||||
@ -136,15 +131,6 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
|||||||
#[ORM\JoinTable(name: 'chill_person_accompanying_period_work_third_party')] // In schema : intervenants
|
#[ORM\JoinTable(name: 'chill_person_accompanying_period_work_third_party')] // In schema : intervenants
|
||||||
private Collection $thirdParties;
|
private Collection $thirdParties;
|
||||||
|
|
||||||
#[Serializer\Groups(['read', 'docgen:read'])]
|
|
||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)]
|
|
||||||
private ?\DateTimeImmutable $updatedAt = null;
|
|
||||||
|
|
||||||
#[Serializer\Groups(['read', 'docgen:read'])]
|
|
||||||
#[ORM\ManyToOne(targetEntity: User::class)]
|
|
||||||
#[ORM\JoinColumn(nullable: false)]
|
|
||||||
private ?User $updatedBy = null;
|
|
||||||
|
|
||||||
#[Serializer\Groups(['read', 'accompanying_period_work:edit'])]
|
#[Serializer\Groups(['read', 'accompanying_period_work:edit'])]
|
||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: false, options: ['default' => 1])]
|
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: false, options: ['default' => 1])]
|
||||||
#[ORM\Version]
|
#[ORM\Version]
|
||||||
@ -231,11 +217,6 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
|||||||
return $this->accompanyingPeriodWorkEvaluations;
|
return $this->accompanyingPeriodWorkEvaluations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCreatedAt(): ?\DateTimeImmutable
|
|
||||||
{
|
|
||||||
return $this->createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCreatedAutomatically(): ?bool
|
public function getCreatedAutomatically(): ?bool
|
||||||
{
|
{
|
||||||
return $this->createdAutomatically;
|
return $this->createdAutomatically;
|
||||||
@ -246,11 +227,6 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
|||||||
return $this->createdAutomaticallyReason;
|
return $this->createdAutomaticallyReason;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCreatedBy(): ?User
|
|
||||||
{
|
|
||||||
return $this->createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getEndDate(): ?\DateTimeInterface
|
public function getEndDate(): ?\DateTimeInterface
|
||||||
{
|
{
|
||||||
return $this->endDate;
|
return $this->endDate;
|
||||||
@ -365,16 +341,6 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
|||||||
return $this->getThirdParties();
|
return $this->getThirdParties();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUpdatedAt(): ?\DateTimeImmutable
|
|
||||||
{
|
|
||||||
return $this->updatedAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getUpdatedBy(): ?User
|
|
||||||
{
|
|
||||||
return $this->updatedBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getVersion(): int
|
public function getVersion(): int
|
||||||
{
|
{
|
||||||
return $this->version;
|
return $this->version;
|
||||||
@ -470,13 +436,6 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCreatedAt(\DateTimeInterface $createdAt): self
|
|
||||||
{
|
|
||||||
$this->createdAt = $createdAt;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setCreatedAutomatically(bool $createdAutomatically): self
|
public function setCreatedAutomatically(bool $createdAutomatically): self
|
||||||
{
|
{
|
||||||
$this->createdAutomatically = $createdAutomatically;
|
$this->createdAutomatically = $createdAutomatically;
|
||||||
@ -491,13 +450,6 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCreatedBy(?User $user): self
|
|
||||||
{
|
|
||||||
$this->createdBy = $user;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setEndDate(?\DateTimeInterface $endDate = null): self
|
public function setEndDate(?\DateTimeInterface $endDate = null): self
|
||||||
{
|
{
|
||||||
$this->endDate = $endDate;
|
$this->endDate = $endDate;
|
||||||
@ -539,18 +491,4 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUpdatedAt(\DateTimeInterface $datetime): TrackUpdateInterface
|
|
||||||
{
|
|
||||||
$this->updatedAt = $datetime instanceof \DateTime ? \DateTimeImmutable::createFromMutable($datetime) : $datetime;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setUpdatedBy(User $user): TrackUpdateInterface
|
|
||||||
{
|
|
||||||
$this->updatedBy = $user;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Person;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20250527122841 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Remove NOT NULL constraints for created and updated properties on accompanying period work';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
ALTER TABLE chill_person_accompanying_period_work ALTER createdby_id DROP NOT NULL
|
||||||
|
SQL);
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
ALTER TABLE chill_person_accompanying_period_work ALTER updatedby_id DROP NOT NULL
|
||||||
|
SQL);
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
ALTER TABLE chill_person_accompanying_period_work ALTER createdat DROP NOT NULL
|
||||||
|
SQL);
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
ALTER TABLE chill_person_accompanying_period_work ALTER updatedat DROP NOT NULL
|
||||||
|
SQL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
ALTER TABLE chill_person_accompanying_period_work ALTER createdAt SET NOT NULL
|
||||||
|
SQL);
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
ALTER TABLE chill_person_accompanying_period_work ALTER updatedAt SET NOT NULL
|
||||||
|
SQL);
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
ALTER TABLE chill_person_accompanying_period_work ALTER createdBy_id SET NOT NULL
|
||||||
|
SQL);
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
ALTER TABLE chill_person_accompanying_period_work ALTER updatedBy_id SET NOT NULL
|
||||||
|
SQL);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user