Apply rector rules: add annotation for doctrine mapping

This commit is contained in:
Julien Fastré 2024-04-05 00:01:30 +02:00
parent 579bd829f8
commit 72016e1a21
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
124 changed files with 1724 additions and 3770 deletions

View File

@ -42,6 +42,7 @@ return static function (RectorConfig $rectorConfig): void {
\Rector\Symfony\Set\SymfonySetList::SYMFONY_53, \Rector\Symfony\Set\SymfonySetList::SYMFONY_53,
\Rector\Symfony\Set\SymfonySetList::SYMFONY_54, \Rector\Symfony\Set\SymfonySetList::SYMFONY_54,
\Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_CODE_QUALITY, \Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_CODE_QUALITY,
\Rector\Doctrine\Set\DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
]); ]);
// migrate for phpunit // migrate for phpunit

View File

@ -44,11 +44,8 @@ use Symfony\Component\Validator\Constraints as Assert;
/** /**
* Class Activity. * Class Activity.
* *
* @ORM\Entity(repositoryClass="Chill\ActivityBundle\Repository\ActivityRepository")
* *
* @ORM\Table(name="activity")
* *
* @ORM\HasLifecycleCallbacks
* *
* @ActivityValidator\ActivityValidity * @ActivityValidator\ActivityValidity
* *
@ -59,6 +56,9 @@ use Symfony\Component\Validator\Constraints as Assert;
* path="scope") * path="scope")
*/ */
#[DiscriminatorMap(typeProperty: 'type', mapping: ['activity' => Activity::class])] #[DiscriminatorMap(typeProperty: 'type', mapping: ['activity' => Activity::class])]
#[ORM\Entity(repositoryClass: \Chill\ActivityBundle\Repository\ActivityRepository::class)]
#[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'activity')]
class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, HasCentersInterface, HasScopesInterface, TrackCreationInterface, TrackUpdateInterface class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, HasCentersInterface, HasScopesInterface, TrackCreationInterface, TrackUpdateInterface
{ {
use TrackCreationTrait; use TrackCreationTrait;
@ -69,157 +69,121 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
final public const SENTRECEIVED_SENT = 'sent'; final public const SENTRECEIVED_SENT = 'sent';
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod")
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod::class)]
private ?AccompanyingPeriod $accompanyingPeriod = null; private ?AccompanyingPeriod $accompanyingPeriod = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
*
* @ORM\JoinColumn(name="type_id")
*/
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[SerializedName('activityType')] #[SerializedName('activityType')]
#[ORM\ManyToOne(targetEntity: \Chill\ActivityBundle\Entity\ActivityType::class)]
#[ORM\JoinColumn(name: 'type_id')]
private ActivityType $activityType; private ActivityType $activityType;
/**
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence")
*/
#[Groups(['docgen:read'])] #[Groups(['docgen:read'])]
#[ORM\ManyToOne(targetEntity: \Chill\ActivityBundle\Entity\ActivityPresence::class)]
private ?ActivityPresence $attendee = null; private ?ActivityPresence $attendee = null;
/**
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
*/
#[Groups(['docgen:read'])] #[Groups(['docgen:read'])]
#[ORM\Embedded(class: \Chill\MainBundle\Entity\Embeddable\CommentEmbeddable::class, columnPrefix: 'comment_')]
private CommentEmbeddable $comment; private CommentEmbeddable $comment;
/**
* @ORM\Column(type="datetime")
*/
#[Groups(['docgen:read'])] #[Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)]
private \DateTime $date; private \DateTime $date;
/** /**
* @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject", cascade={"persist"})
*
* @var Collection<StoredObject> * @var Collection<StoredObject>
*/ */
#[Assert\Valid(traverse: true)] #[Assert\Valid(traverse: true)]
#[ORM\ManyToMany(targetEntity: \Chill\DocStoreBundle\Entity\StoredObject::class, cascade: ['persist'])]
private Collection $documents; private Collection $documents;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TIME_MUTABLE, nullable: true)]
* @ORM\Column(type="time", nullable=true)
*/
private ?\DateTime $durationTime = null; private ?\DateTime $durationTime = null;
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
#[Groups(['docgen:read'])] #[Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
private bool $emergency = false; private bool $emergency = false;
/**
* @ORM\Id
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null; private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location")
*/
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Location::class)]
private ?Location $location = null; private ?Location $location = null;
/** #[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\Person::class)]
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
*/
private ?Person $person = null; private ?Person $person = null;
/** /**
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
*
* @var Collection<Person> * @var Collection<Person>
*/ */
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\ManyToMany(targetEntity: \Chill\PersonBundle\Entity\Person::class)]
private Collection $persons; private Collection $persons;
/** #[ORM\Embedded(class: \Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable::class, columnPrefix: 'privateComment_')]
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_")
*/
private PrivateCommentEmbeddable $privateComment; private PrivateCommentEmbeddable $privateComment;
/** /**
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
*
* @var Collection<ActivityReason> * @var Collection<ActivityReason>
*/ */
#[Groups(['docgen:read'])] #[Groups(['docgen:read'])]
#[ORM\ManyToMany(targetEntity: \Chill\ActivityBundle\Entity\ActivityReason::class)]
private Collection $reasons; private Collection $reasons;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
*/
#[Groups(['docgen:read'])] #[Groups(['docgen:read'])]
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Scope::class)]
private ?Scope $scope = null; private ?Scope $scope = null;
/**
* @ORM\Column(type="string", options={"default": ""})
*/
#[Groups(['docgen:read'])] #[Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, options: ['default' => ''])]
private string $sentReceived = ''; private string $sentReceived = '';
/** /**
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction")
* *
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction")
* *
* @var Collection<SocialAction> * @var Collection<SocialAction>
*/ */
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\ManyToMany(targetEntity: \Chill\PersonBundle\Entity\SocialWork\SocialAction::class)]
#[ORM\JoinTable(name: 'chill_activity_activity_chill_person_socialaction')]
private Collection $socialActions; private Collection $socialActions;
/** /**
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue")
* *
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue")
* *
* @var Collection<SocialIssue> * @var Collection<SocialIssue>
*/ */
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\ManyToMany(targetEntity: \Chill\PersonBundle\Entity\SocialWork\SocialIssue::class)]
#[ORM\JoinTable(name: 'chill_activity_activity_chill_person_socialissue')]
private Collection $socialIssues; private Collection $socialIssues;
/** /**
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
*
* @var Collection<ThirdParty> * @var Collection<ThirdParty>
*/ */
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\ManyToMany(targetEntity: \Chill\ThirdPartyBundle\Entity\ThirdParty::class)]
private Collection $thirdParties; private Collection $thirdParties;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TIME_MUTABLE, nullable: true)]
* @ORM\Column(type="time", nullable=true)
*/
private ?\DateTime $travelTime = null; private ?\DateTime $travelTime = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*/
#[Groups(['docgen:read'])] #[Groups(['docgen:read'])]
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)]
private ?User $user = null; private ?User $user = null;
/** /**
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
*
* @var Collection<User> * @var Collection<User>
*/ */
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\ManyToMany(targetEntity: \Chill\MainBundle\Entity\User::class)]
private Collection $users; private Collection $users;
public function __construct() public function __construct()

View File

@ -17,35 +17,29 @@ use Symfony\Component\Serializer\Annotation as Serializer;
/** /**
* Class ActivityPresence. * Class ActivityPresence.
* *
* @ORM\Entity
* *
* @ORM\Table(name="activitytpresence")
* *
* @ORM\HasLifecycleCallbacks
*/ */
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'activitytpresence')]
class ActivityPresence class ActivityPresence
{ {
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
* @ORM\Column(type="boolean")
*/
private bool $active = true; private bool $active = true;
/**
* @ORM\Id
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[Serializer\Groups(['docgen:read'])] #[Serializer\Groups(['docgen:read'])]
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null; private ?int $id = null;
/** /**
* @ORM\Column(type="json")
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/ */
#[Serializer\Groups(['docgen:read'])] #[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $name = []; private array $name = [];
/** /**

View File

@ -16,38 +16,27 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* Class ActivityReason. * Class ActivityReason.
* *
* @ORM\Entity
* *
* @ORM\Table(name="activityreason")
* *
* @ORM\HasLifecycleCallbacks
*/ */
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'activityreason')]
class ActivityReason class ActivityReason
{ {
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
* @ORM\Column(type="boolean")
*/
private bool $active = true; private bool $active = true;
/** #[ORM\ManyToOne(targetEntity: \Chill\ActivityBundle\Entity\ActivityReasonCategory::class, inversedBy: 'reasons')]
* @ORM\ManyToOne(
* targetEntity="Chill\ActivityBundle\Entity\ActivityReasonCategory",
* inversedBy="reasons")
*/
private ?ActivityReasonCategory $category = null; private ?ActivityReasonCategory $category = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(name="id", type="integer") #[ORM\GeneratedValue(strategy: 'AUTO')]
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
* @ORM\Column(type="json")
*/
private array $name; private array $name;
/** /**

View File

@ -18,44 +18,35 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* Class ActivityReasonCategory. * Class ActivityReasonCategory.
* *
* @ORM\Entity
* *
* @ORM\Table(name="activityreasoncategory")
* *
* @ORM\HasLifecycleCallbacks
*/ */
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'activityreasoncategory')]
class ActivityReasonCategory implements \Stringable class ActivityReasonCategory implements \Stringable
{ {
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
* @ORM\Column(type="boolean")
*/
private bool $active = true; private bool $active = true;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(name="id", type="integer") #[ORM\GeneratedValue(strategy: 'AUTO')]
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null; private ?int $id = null;
/** /**
* @var string * @var string
*
* @ORM\Column(type="json")
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private $name; private $name;
/** /**
* Array of ActivityReason. * Array of ActivityReason.
* *
* @var Collection<ActivityReason> * @var Collection<ActivityReason>
*
* @ORM\OneToMany(
* targetEntity="Chill\ActivityBundle\Entity\ActivityReason",
* mappedBy="category")
*/ */
#[ORM\OneToMany(targetEntity: \Chill\ActivityBundle\Entity\ActivityReason::class, mappedBy: 'category')]
private Collection $reasons; private Collection $reasons;
/** /**

View File

@ -20,12 +20,12 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
/** /**
* Class ActivityType. * Class ActivityType.
* *
* @ORM\Entity
* *
* @ORM\Table(name="activitytype")
* *
* @ORM\HasLifecycleCallbacks
*/ */
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'activitytype')]
class ActivityType class ActivityType
{ {
final public const FIELD_INVISIBLE = 0; final public const FIELD_INVISIBLE = 0;
@ -36,247 +36,161 @@ class ActivityType
/** /**
* @deprecated not in use * @deprecated not in use
*
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
private string $accompanyingPeriodLabel = ''; private string $accompanyingPeriodLabel = '';
/** /**
* @deprecated not in use * @deprecated not in use
*
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])]
private int $accompanyingPeriodVisible = self::FIELD_INVISIBLE; private int $accompanyingPeriodVisible = self::FIELD_INVISIBLE;
/**
* @ORM\Column(type="boolean")
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $active = true; private bool $active = true;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
private string $attendeeLabel = ''; private string $attendeeLabel = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])]
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*/
private int $attendeeVisible = self::FIELD_OPTIONAL; private int $attendeeVisible = self::FIELD_OPTIONAL;
/** #[ORM\ManyToOne(targetEntity: \Chill\ActivityBundle\Entity\ActivityTypeCategory::class)]
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityTypeCategory")
*/
private ?ActivityTypeCategory $category = null; private ?ActivityTypeCategory $category = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
private string $commentLabel = ''; private string $commentLabel = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])]
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*/
private int $commentVisible = self::FIELD_OPTIONAL; private int $commentVisible = self::FIELD_OPTIONAL;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
private string $dateLabel = ''; private string $dateLabel = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 2])]
* @ORM\Column(type="smallint", nullable=false, options={"default": 2})
*/
private int $dateVisible = self::FIELD_REQUIRED; private int $dateVisible = self::FIELD_REQUIRED;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
private string $documentsLabel = ''; private string $documentsLabel = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])]
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*/
private int $documentsVisible = self::FIELD_OPTIONAL; private int $documentsVisible = self::FIELD_OPTIONAL;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
private string $durationTimeLabel = ''; private string $durationTimeLabel = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])]
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*/
private int $durationTimeVisible = self::FIELD_OPTIONAL; private int $durationTimeVisible = self::FIELD_OPTIONAL;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
private string $emergencyLabel = ''; private string $emergencyLabel = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])]
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*/
private int $emergencyVisible = self::FIELD_INVISIBLE; private int $emergencyVisible = self::FIELD_INVISIBLE;
/**
* @ORM\Id
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[Groups(['docgen:read'])] #[Groups(['docgen:read'])]
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null; private ?int $id = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
private string $locationLabel = ''; private string $locationLabel = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])]
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*/
private int $locationVisible = self::FIELD_INVISIBLE; private int $locationVisible = self::FIELD_INVISIBLE;
/** /**
* @ORM\Column(type="json")
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/ */
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $name = []; private array $name = [];
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, options: ['default' => '0.0'])]
* @ORM\Column(type="float", options={"default": "0.0"})
*/
private float $ordering = 0.0; private float $ordering = 0.0;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
private string $personLabel = ''; private string $personLabel = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
private string $personsLabel = ''; private string $personsLabel = '';
/**
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])]
private int $personsVisible = self::FIELD_OPTIONAL; private int $personsVisible = self::FIELD_OPTIONAL;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 2])]
* @ORM\Column(type="smallint", nullable=false, options={"default": 2})
*/
private int $personVisible = self::FIELD_REQUIRED; private int $personVisible = self::FIELD_REQUIRED;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
private string $privateCommentLabel = ''; private string $privateCommentLabel = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])]
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*/
private int $privateCommentVisible = self::FIELD_OPTIONAL; private int $privateCommentVisible = self::FIELD_OPTIONAL;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
private string $reasonsLabel = ''; private string $reasonsLabel = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])]
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*/
private int $reasonsVisible = self::FIELD_OPTIONAL; private int $reasonsVisible = self::FIELD_OPTIONAL;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
private string $sentReceivedLabel = ''; private string $sentReceivedLabel = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])]
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*/
private int $sentReceivedVisible = self::FIELD_OPTIONAL; private int $sentReceivedVisible = self::FIELD_OPTIONAL;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
private string $socialActionsLabel = ''; private string $socialActionsLabel = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])]
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*/
private int $socialActionsVisible = self::FIELD_INVISIBLE; private int $socialActionsVisible = self::FIELD_INVISIBLE;
/** /**
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*
* @deprecated not in use * @deprecated not in use
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
private string $socialDataLabel = ''; private string $socialDataLabel = '';
/** /**
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*
* @deprecated not in use * @deprecated not in use
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])]
private int $socialDataVisible = self::FIELD_INVISIBLE; private int $socialDataVisible = self::FIELD_INVISIBLE;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
private string $socialIssuesLabel = ''; private string $socialIssuesLabel = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])]
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*/
private int $socialIssuesVisible = self::FIELD_INVISIBLE; private int $socialIssuesVisible = self::FIELD_INVISIBLE;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
private string $thirdPartiesLabel = ''; private string $thirdPartiesLabel = '';
/**
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])]
private int $thirdPartiesVisible = self::FIELD_INVISIBLE; private int $thirdPartiesVisible = self::FIELD_INVISIBLE;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
private string $travelTimeLabel = ''; private string $travelTimeLabel = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])]
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*/
private int $travelTimeVisible = self::FIELD_OPTIONAL; private int $travelTimeVisible = self::FIELD_OPTIONAL;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
private string $userLabel = ''; private string $userLabel = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
private string $usersLabel = ''; private string $usersLabel = '';
/**
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])]
private int $usersVisible = self::FIELD_OPTIONAL; private int $usersVisible = self::FIELD_OPTIONAL;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 2])]
* @ORM\Column(type="smallint", nullable=false, options={"default": 2})
*/
private int $userVisible = self::FIELD_REQUIRED; private int $userVisible = self::FIELD_REQUIRED;
#[Assert\Callback] #[Assert\Callback]

View File

@ -13,37 +13,25 @@ namespace Chill\ActivityBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\HasLifecycleCallbacks]
* @ORM\Table(name="activitytypecategory") #[ORM\Table(name: 'activitytypecategory')]
*
* @ORM\HasLifecycleCallbacks
*/
class ActivityTypeCategory class ActivityTypeCategory
{ {
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
* @ORM\Column(type="boolean")
*/
private bool $active = true; private bool $active = true;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(name="id", type="integer") #[ORM\GeneratedValue(strategy: 'AUTO')]
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
* @ORM\Column(type="json")
*/
private array $name = []; private array $name = [];
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, options: ['default' => '0.0'])]
* @ORM\Column(type="float", options={"default": "0.0"})
*/
private float $ordering = 0.0; private float $ordering = 0.0;
/** /**

View File

@ -18,79 +18,54 @@ use Chill\MainBundle\Entity\Location;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Table(schema: 'chill_asideactivity')]
* @ORM\Table(schema="chill_asideactivity")
*/
class AsideActivity implements TrackCreationInterface, TrackUpdateInterface class AsideActivity implements TrackCreationInterface, TrackUpdateInterface
{ {
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[Assert\NotBlank] #[Assert\NotBlank]
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: false)]
private User $agent; private User $agent;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)]
* @ORM\Column(type="datetime")
*/
private ?\DateTimeInterface $createdAt = null; private ?\DateTimeInterface $createdAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class) #[ORM\ManyToOne(targetEntity: User::class)]
* #[ORM\JoinColumn(nullable: false)]
* @ORM\JoinColumn(nullable=false)
*/
private User $createdBy; private User $createdBy;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)]
* @ORM\Column(type="datetime")
*/
private ?\DateTimeInterface $date = null; private ?\DateTimeInterface $date = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TIME_MUTABLE, nullable: true)]
* @ORM\Column(type="time", nullable=true)
*/
private ?\DateTimeInterface $duration = null; private ?\DateTimeInterface $duration = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=Location::class) #[ORM\ManyToOne(targetEntity: Location::class)]
* #[ORM\JoinColumn(nullable: true)]
* @ORM\JoinColumn(nullable=true)
*/
private ?Location $location = null; private ?Location $location = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
* @ORM\Column(type="text", nullable=true)
*/
private ?string $note = null; private ?string $note = null;
/**
* @ORM\ManyToOne(targetEntity=AsideActivityCategory::class, inversedBy="asideActivities") #[ORM\ManyToOne(targetEntity: AsideActivityCategory::class, inversedBy: 'asideActivities')]
* #[ORM\JoinColumn(nullable: false)]
* @ORM\JoinColumn(nullable=false)
*/
private ?AsideActivityCategory $type = null; private ?AsideActivityCategory $type = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)]
* @ORM\Column(type="datetime", nullable=true)
*/
private ?\DateTimeInterface $updatedAt = null; private ?\DateTimeInterface $updatedAt = null;
/** #[ORM\ManyToOne(targetEntity: User::class)]
* @ORM\ManyToOne(targetEntity=User::class)
*/
private User $updatedBy; private User $updatedBy;
public function getAgent(): ?User public function getAgent(): ?User

View File

@ -17,51 +17,37 @@ use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Table(schema: 'chill_asideactivity')]
* @ORM\Table(schema="chill_asideactivity")
*/
class AsideActivityCategory class AsideActivityCategory
{ {
/** /**
* @ORM\OneToMany(targetEntity=AsideActivityCategory::class, mappedBy="parent")
*
* @var Collection<AsideActivityCategory> * @var Collection<AsideActivityCategory>
*/ */
#[ORM\OneToMany(targetEntity: AsideActivityCategory::class, mappedBy: 'parent')]
private Collection $children; private Collection $children;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private int $id; private int $id;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
* @ORM\Column(type="boolean")
*/
private bool $isActive = true; private bool $isActive = true;
private AsideActivityCategory $oldParent; private AsideActivityCategory $oldParent;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, options: ['default' => '0.00'])]
* @ORM\Column(type="float", options={"default": 0.00})
*/
private float $ordering = 0.00; private float $ordering = 0.00;
/**
* @ORM\ManyToOne(targetEntity=AsideActivityCategory::class, inversedBy="children") #[ORM\ManyToOne(targetEntity: AsideActivityCategory::class, inversedBy: 'children')]
* #[ORM\JoinColumn(nullable: true)]
* @ORM\JoinColumn(nullable=true)
*/
private ?AsideActivityCategory $parent = null; private ?AsideActivityCategory $parent = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255)]
* @ORM\Column(type="json", length=255)
*/
private array $title; private array $title;
public function __construct() public function __construct()

View File

@ -20,52 +20,33 @@ use Symfony\Component\Validator\Constraints as Assert;
/** /**
* AbstractElement. * AbstractElement.
*
* @ORM\MappedSuperclass
*/ */
#[ORM\MappedSuperclass]
abstract class AbstractElement abstract class AbstractElement
{ {
/**
* @ORM\Column(name="amount", type="decimal", precision=10, scale=2)
*/
#[Assert\GreaterThan(value: 0)] #[Assert\GreaterThan(value: 0)]
#[Assert\NotNull(message: 'The amount cannot be empty')] #[Assert\NotNull(message: 'The amount cannot be empty')]
#[ORM\Column(name: 'amount', type: \Doctrine\DBAL\Types\Types::DECIMAL, precision: 10, scale: 2)]
private string $amount; private string $amount;
/** #[ORM\Column(name: 'comment', type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
* @ORM\Column(name="comment", type="text", nullable=true)
*/
private ?string $comment = null; private ?string $comment = null;
/**
* @ORM\Column(name="endDate", type="datetime_immutable", nullable=true)
*/
#[Assert\GreaterThan(propertyPath: 'startDate', message: "The budget element's end date must be after the start date")] #[Assert\GreaterThan(propertyPath: 'startDate', message: "The budget element's end date must be after the start date")]
#[ORM\Column(name: 'endDate', type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)]
private ?\DateTimeImmutable $endDate = null; private ?\DateTimeImmutable $endDate = null;
/** #[ORM\ManyToOne(targetEntity: Household::class)]
* @ORM\ManyToOne(
* targetEntity="\Chill\PersonBundle\Entity\Household\Household"
* )
*/
private ?Household $household = null; private ?Household $household = null;
/** #[ORM\ManyToOne(targetEntity: Person::class)]
* @ORM\ManyToOne(
* targetEntity="\Chill\PersonBundle\Entity\Person"
* )
*/
private ?Person $person = null; private ?Person $person = null;
/**
* @ORM\Column(name="startDate", type="datetime_immutable")
*/
#[Assert\Date] #[Assert\Date]
#[ORM\Column(name: 'startDate', type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)]
private \DateTimeImmutable $startDate; private \DateTimeImmutable $startDate;
/** #[ORM\Column(name: 'type', type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
* @ORM\Column(name="type", type="string", length=255)
*/
private string $type = ''; private string $type = '';
/* Getters and Setters */ /* Getters and Setters */

View File

@ -18,10 +18,10 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* Charge. * Charge.
* *
* @ORM\Table(name="chill_budget.charge")
* *
* @ORM\Entity(repositoryClass="Chill\BudgetBundle\Repository\ChargeRepository")
*/ */
#[ORM\Entity(repositoryClass: \Chill\BudgetBundle\Repository\ChargeRepository::class)]
#[ORM\Table(name: 'chill_budget.charge')]
class Charge extends AbstractElement implements HasCentersInterface class Charge extends AbstractElement implements HasCentersInterface
{ {
final public const HELP_ASKED = 'running'; final public const HELP_ASKED = 'running';
@ -39,25 +39,18 @@ class Charge extends AbstractElement implements HasCentersInterface
self::HELP_NOT_RELEVANT, self::HELP_NOT_RELEVANT,
]; ];
/**
* @ORM\ManyToOne(targetEntity=ChargeKind::class, inversedBy="AbstractElement") #[ORM\ManyToOne(targetEntity: ChargeKind::class, inversedBy: 'AbstractElement')]
* #[ORM\JoinColumn]
* @ORM\JoinColumn
*/
private ?ChargeKind $charge = null; private ?ChargeKind $charge = null;
/** #[ORM\Column(name: 'help', type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)]
* @ORM\Column(name="help", type="string", nullable=true)
*/
private ?string $help = self::HELP_NOT_RELEVANT; private ?string $help = self::HELP_NOT_RELEVANT;
/**
* @ORM\Column(name="id", type="integer") #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
* #[ORM\Id]
* @ORM\Id #[ORM\GeneratedValue(strategy: 'AUTO')]
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null; private ?int $id = null;
public function __construct() public function __construct()

View File

@ -18,49 +18,35 @@ use Symfony\Component\Validator\Constraints as Assert;
/** /**
* Type of charge. * Type of charge.
* *
* @ORM\Table(name="chill_budget.charge_type",
* uniqueConstraints={@ORM\UniqueConstraint(name="charge_kind_unique_type_idx", fields={"kind"})}
* )
* *
* @ORM\Entity
*/ */
#[UniqueEntity(fields: ['kind'])] #[UniqueEntity(fields: ['kind'])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_budget.charge_type')]
#[ORM\UniqueConstraint(name: 'charge_kind_unique_type_idx', fields: ['kind'])]
class ChargeKind class ChargeKind
{ {
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => true])]
* @ORM\Column(type="boolean", options={"default": true})
*/
private bool $isActive = true; private bool $isActive = true;
/**
* @ORM\Column(type="string", length=255, options={"default": ""}, nullable=false)
*/
#[Assert\Regex(pattern: '/^[a-z0-9\-_]{1,}$/', message: 'budget.admin.form.kind.only_alphanumeric')] #[Assert\Regex(pattern: '/^[a-z0-9\-_]{1,}$/', message: 'budget.admin.form.kind.only_alphanumeric')]
#[Assert\Length(min: 3)] #[Assert\Length(min: 3)]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, options: ['default' => ''], nullable: false)]
private string $kind = ''; private string $kind = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '[]'])]
* @ORM\Column(type="json", length=255, options={"default": "[]"})
*/
private array $name = []; private array $name = [];
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, options: ['default' => '0.00'])]
* @ORM\Column(type="float", options={"default": 0.00})
*/
private float $ordering = 0.00; private float $ordering = 0.00;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '[]'])]
* @ORM\Column(type="json", length=255, options={"default": "[]"})
*/
private array $tags = []; private array $tags = [];
public function getId(): ?int public function getId(): ?int

View File

@ -18,26 +18,21 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* Resource. * Resource.
* *
* @ORM\Table(name="chill_budget.resource")
* *
* @ORM\Entity(repositoryClass="Chill\BudgetBundle\Repository\ResourceRepository")
*/ */
#[ORM\Entity(repositoryClass: \Chill\BudgetBundle\Repository\ResourceRepository::class)]
#[ORM\Table(name: 'chill_budget.resource')]
class Resource extends AbstractElement implements HasCentersInterface class Resource extends AbstractElement implements HasCentersInterface
{ {
/**
* @ORM\Column(name="id", type="integer") #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
* #[ORM\Id]
* @ORM\Id #[ORM\GeneratedValue(strategy: 'AUTO')]
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null; private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=ResourceKind::class, inversedBy="AbstractElement") #[ORM\ManyToOne(targetEntity: ResourceKind::class, inversedBy: 'AbstractElement')]
* #[ORM\JoinColumn]
* @ORM\JoinColumn
*/
private ?ResourceKind $resource = null; private ?ResourceKind $resource = null;
public function __construct() public function __construct()

View File

@ -18,52 +18,37 @@ use Symfony\Component\Validator\Constraints as Assert;
/** /**
* Type of resource. * Type of resource.
* *
* @ORM\Table(name="chill_budget.resource_type", uniqueConstraints={
* *
* @ORM\UniqueConstraint(name="resource_kind_unique_type_idx", fields={"kind"})
* })
* @ORM\UniqueConstraint(name="resource_kind_unique_type_idx", fields={"kind"})
* })
*
* @ORM\Entity
*/ */
#[UniqueEntity(fields: ['kind'])] #[UniqueEntity(fields: ['kind'])]
#[ORM\UniqueConstraint(name: 'resource_kind_unique_type_idx', fields: ['kind'])] // @ORM\Entity
#[ORM\Table(name: 'chill_budget.resource_type')]
#[ORM\UniqueConstraint(name: 'resource_kind_unique_type_idx', fields: ['kind'])]
#[ORM\UniqueConstraint(name: 'resource_kind_unique_type_idx', fields: ['kind'])]
#[ORM\Entity] // @ORM\Entity
class ResourceKind class ResourceKind
{ {
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => true])]
* @ORM\Column(type="boolean", options={"default": true})
*/
private bool $isActive = true; private bool $isActive = true;
/**
* @ORM\Column(type="string", length=255, nullable=false, options={"default": ""})
*/
#[Assert\Regex(pattern: '/^[a-z0-9\-_]{1,}$/', message: 'budget.admin.form.kind.only_alphanumeric')] #[Assert\Regex(pattern: '/^[a-z0-9\-_]{1,}$/', message: 'budget.admin.form.kind.only_alphanumeric')]
#[Assert\Length(min: 3)] #[Assert\Length(min: 3)]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: false, options: ['default' => ''])]
private string $kind = ''; private string $kind = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '[]'])]
* @ORM\Column(type="json", length=255, options={"default": "[]"})
*/
private array $name = []; private array $name = [];
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, options: ['default' => '0.00'])]
* @ORM\Column(type="float", options={"default": 0.00})
*/
private float $ordering = 0.00; private float $ordering = 0.00;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '[]'])]
* @ORM\Column(type="json", length=255, options={"default": "[]"})
*/
private array $tags = []; private array $tags = [];
public function getId(): ?int public function getId(): ?int

View File

@ -36,15 +36,11 @@ use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Range; use Symfony\Component\Validator\Constraints\Range;
use Symfony\Component\Validator\Mapping\ClassMetadata; use Symfony\Component\Validator\Mapping\ClassMetadata;
/**
* @ORM\Table(
* name="chill_calendar.calendar",
* uniqueConstraints={@ORM\UniqueConstraint(name="idx_calendar_remote", columns={"remoteId"}, options={"where": "remoteId <> ''"})}
* )
*
* @ORM\Entity
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_calendar_calendar' => Calendar::class])] #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_calendar_calendar' => Calendar::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_calendar.calendar')]
#[ORM\UniqueConstraint(name: 'idx_calendar_remote', columns: ['remoteId'], options: ['where' => "remoteId <> ''"])]
class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCentersInterface class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCentersInterface
{ {
use RemoteCalendarTrait; use RemoteCalendarTrait;
@ -86,105 +82,75 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
public ?User $previousMainUser = null; public ?User $previousMainUser = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod", inversedBy="calendars")
*/
#[Serializer\Groups(['calendar:read', 'read'])] #[Serializer\Groups(['calendar:read', 'read'])]
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod::class, inversedBy: 'calendars')]
private ?AccompanyingPeriod $accompanyingPeriod = null; private ?AccompanyingPeriod $accompanyingPeriod = null;
/** #[ORM\ManyToOne(targetEntity: \Chill\ActivityBundle\Entity\Activity::class)]
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\Activity")
*/
private ?Activity $activity = null; private ?Activity $activity = null;
/**
* @ORM\OneToOne(targetEntity="CalendarRange", inversedBy="calendar")
*/
#[Serializer\Groups(['calendar:read', 'read'])] #[Serializer\Groups(['calendar:read', 'read'])]
#[ORM\OneToOne(targetEntity: \CalendarRange::class, inversedBy: 'calendar')]
private ?CalendarRange $calendarRange = null; private ?CalendarRange $calendarRange = null;
/** #[ORM\ManyToOne(targetEntity: \CancelReason::class)]
* @ORM\ManyToOne(targetEntity="CancelReason")
*/
private ?CancelReason $cancelReason = null; private ?CancelReason $cancelReason = null;
/**
* @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_")
*/
#[Serializer\Groups(['calendar:read', 'read', 'docgen:read'])] #[Serializer\Groups(['calendar:read', 'read', 'docgen:read'])]
#[ORM\Embedded(class: CommentEmbeddable::class, columnPrefix: 'comment_')]
private CommentEmbeddable $comment; private CommentEmbeddable $comment;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: false, options: ['default' => 0])]
* @ORM\Column(type="integer", nullable=false, options={"default": 0})
*/
private int $dateTimeVersion = 0; private int $dateTimeVersion = 0;
/** /**
* @var Collection<CalendarDoc> * @var Collection<CalendarDoc>
*
* @ORM\OneToMany(targetEntity=CalendarDoc::class, mappedBy="calendar", orphanRemoval=true)
*/ */
#[ORM\OneToMany(targetEntity: CalendarDoc::class, mappedBy: 'calendar', orphanRemoval: true)]
private Collection $documents; private Collection $documents;
/**
* @ORM\Column(type="datetime_immutable", nullable=false)
*/
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
#[Assert\NotNull(message: 'calendar.An end date is required')] #[Assert\NotNull(message: 'calendar.An end date is required')]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)]
private ?\DateTimeImmutable $endDate = null; private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/** /**
* @ORM\OneToMany(
* targetEntity=Invite::class,
* mappedBy="calendar",
* orphanRemoval=true,
* cascade={"persist", "remove", "merge", "detach"}
* )
* *
* @ORM\JoinTable(name="chill_calendar.calendar_to_invites")
* *
* @var Collection&Selectable<int, Invite> * @var Collection&Selectable<int, Invite>
*/ */
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\OneToMany(targetEntity: Invite::class, mappedBy: 'calendar', orphanRemoval: true, cascade: ['persist', 'remove', 'merge', 'detach'])]
#[ORM\JoinTable(name: 'chill_calendar.calendar_to_invites')]
private Collection&Selectable $invites; private Collection&Selectable $invites;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location")
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[Assert\NotNull(message: 'calendar.A location is required')] #[Assert\NotNull(message: 'calendar.A location is required')]
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Location::class)]
private ?Location $location = null; private ?Location $location = null;
/** /**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
*/ */
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
#[Assert\NotNull(message: 'calendar.A main user is mandatory')] #[Assert\NotNull(message: 'calendar.A main user is mandatory')]
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)]
private ?User $mainUser = null; private ?User $mainUser = null;
/**
* @ORM\ManyToOne(targetEntity=Person::class) #[ORM\ManyToOne(targetEntity: Person::class)]
* #[ORM\JoinColumn(nullable: true)]
* @ORM\JoinColumn(nullable=true)
*/
private ?Person $person = null; private ?Person $person = null;
/** /**
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person", inversedBy="calendars")
* *
* @ORM\JoinTable(name="chill_calendar.calendar_to_persons")
* *
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
* *
@ -192,58 +158,50 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
*/ */
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
#[Assert\Count(min: 1, minMessage: 'calendar.At least {{ limit }} person is required.')] #[Assert\Count(min: 1, minMessage: 'calendar.At least {{ limit }} person is required.')]
#[ORM\ManyToMany(targetEntity: \Chill\PersonBundle\Entity\Person::class, inversedBy: 'calendars')]
#[ORM\JoinTable(name: 'chill_calendar.calendar_to_persons')]
private Collection $persons; private Collection $persons;
/**
* @ORM\Embedded(class=PrivateCommentEmbeddable::class, columnPrefix="privateComment_")
*/
#[Serializer\Groups(['calendar:read'])] #[Serializer\Groups(['calendar:read'])]
#[ORM\Embedded(class: PrivateCommentEmbeddable::class, columnPrefix: 'privateComment_')]
private PrivateCommentEmbeddable $privateComment; private PrivateCommentEmbeddable $privateComment;
/** /**
* @var Collection<ThirdParty> * @var Collection<ThirdParty>
* *
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
* *
* @ORM\JoinTable(name="chill_calendar.calendar_to_thirdparties")
* *
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
*/ */
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
#[ORM\ManyToMany(targetEntity: \Chill\ThirdPartyBundle\Entity\ThirdParty::class)]
#[ORM\JoinTable(name: 'chill_calendar.calendar_to_thirdparties')]
private Collection $professionals; private Collection $professionals;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
#[Serializer\Groups(['docgen:read'])] #[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: true)]
private ?bool $sendSMS = false; private ?bool $sendSMS = false;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => Calendar::SMS_PENDING])]
* @ORM\Column(type="text", nullable=false, options={"default": Calendar::SMS_PENDING})
*/
private string $smsStatus = self::SMS_PENDING; private string $smsStatus = self::SMS_PENDING;
/** /**
* @ORM\Column(type="datetime_immutable", nullable=false)
*
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
*/ */
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
#[Assert\NotNull(message: 'calendar.A start date is required')] #[Assert\NotNull(message: 'calendar.A start date is required')]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)]
private ?\DateTimeImmutable $startDate = null; private ?\DateTimeImmutable $startDate = null;
/** /**
* @ORM\Column(type="string", length=255, nullable=false, options={"default": "valid"})
*
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
*/ */
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light'])] #[Serializer\Groups(['calendar:read', 'read', 'calendar:light'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: false, options: ['default' => 'valid'])]
private string $status = self::STATUS_VALID; private string $status = self::STATUS_VALID;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
#[Serializer\Groups(['docgen:read'])] #[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: true)]
private ?bool $urgent = false; private ?bool $urgent = false;
public function __construct() public function __construct()

View File

@ -20,50 +20,35 @@ use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait; use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Table(name: 'chill_calendar.calendar_doc')]
* @ORM\Table(
* name="chill_calendar.calendar_doc",
* )
*/
class CalendarDoc implements TrackCreationInterface, TrackUpdateInterface class CalendarDoc implements TrackCreationInterface, TrackUpdateInterface
{ {
use TrackCreationTrait; use TrackCreationTrait;
use TrackUpdateTrait; use TrackUpdateTrait;
/**
* @ORM\ManyToOne(targetEntity=Calendar::class, inversedBy="documents") #[ORM\ManyToOne(targetEntity: Calendar::class, inversedBy: 'documents')]
* #[ORM\JoinColumn(nullable: false)]
* @ORM\JoinColumn(nullable=false)
*/
private Calendar $calendar; private Calendar $calendar;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: false, options: ['default' => 0])]
* @ORM\Column(type="integer", nullable=false, options={"default": 0})
*/
private int $datetimeVersion = 0; private int $datetimeVersion = 0;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: false, options: ['default' => false])]
* @ORM\Column(type="boolean", nullable=false, options={"default": false})
*/
private bool $trackDateTimeVersion = false; private bool $trackDateTimeVersion = false;
public function __construct(Calendar $calendar, /** public function __construct(Calendar $calendar,
* @ORM\ManyToOne(targetEntity=StoredObject::class, cascade={"persist"}) #[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
* #[ORM\JoinColumn(nullable: false)]
* @ORM\JoinColumn(nullable=false)
*/
private ?StoredObject $storedObject) private ?StoredObject $storedObject)
{ {
$this->setCalendar($calendar); $this->setCalendar($calendar);

View File

@ -21,14 +21,10 @@ use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Table( #[ORM\Entity]
* name="chill_calendar.calendar_range", #[ORM\Table(name: 'chill_calendar.calendar_range')]
* uniqueConstraints={@ORM\UniqueConstraint(name="idx_calendar_range_remote", columns={"remoteId"}, options={"where": "remoteId <> ''"})} #[ORM\UniqueConstraint(name: 'idx_calendar_range_remote', columns: ['remoteId'], options: ['where' => "remoteId <> ''"])]
* )
*
* @ORM\Entity
*/
class CalendarRange implements TrackCreationInterface, TrackUpdateInterface class CalendarRange implements TrackCreationInterface, TrackUpdateInterface
{ {
use RemoteCalendarTrait; use RemoteCalendarTrait;
@ -37,49 +33,36 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface
use TrackUpdateTrait; use TrackUpdateTrait;
/** #[ORM\OneToOne(targetEntity: Calendar::class, mappedBy: 'calendarRange')]
* @ORM\OneToOne(targetEntity=Calendar::class, mappedBy="calendarRange")
*/
private ?Calendar $calendar = null; private ?Calendar $calendar = null;
/**
* @ORM\Column(type="datetime_immutable", nullable=false)
*/
#[Groups(['read', 'write', 'calendar:read'])] #[Groups(['read', 'write', 'calendar:read'])]
#[Assert\NotNull] #[Assert\NotNull]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)]
private ?\DateTimeImmutable $endDate = null; private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=Location::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[Groups(['read', 'write', 'calendar:read'])] #[Groups(['read', 'write', 'calendar:read'])]
#[Assert\NotNull] #[Assert\NotNull]
#[ORM\ManyToOne(targetEntity: Location::class)]
#[ORM\JoinColumn(nullable: false)]
private ?Location $location = null; private ?Location $location = null;
/**
* @ORM\Column(type="datetime_immutable", nullable=false)
*/
#[Groups(['read', 'write', 'calendar:read'])] #[Groups(['read', 'write', 'calendar:read'])]
#[Assert\NotNull] #[Assert\NotNull]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)]
private ?\DateTimeImmutable $startDate = null; private ?\DateTimeImmutable $startDate = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*/
#[Groups(['read', 'write', 'calendar:read'])] #[Groups(['read', 'write', 'calendar:read'])]
#[Assert\NotNull] #[Assert\NotNull]
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)]
private ?User $user = null; private ?User $user = null;
public function getCalendar(): ?Calendar public function getCalendar(): ?Calendar

View File

@ -14,11 +14,9 @@ namespace Chill\CalendarBundle\Entity;
use Chill\CalendarBundle\Repository\CancelReasonRepository; use Chill\CalendarBundle\Repository\CancelReasonRepository;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="chill_calendar.cancel_reason") #[ORM\Entity(repositoryClass: CancelReasonRepository::class)]
* #[ORM\Table(name: 'chill_calendar.cancel_reason')]
* @ORM\Entity(repositoryClass=CancelReasonRepository::class)
*/
class CancelReason class CancelReason
{ {
final public const CANCELEDBY_DONOTCOUNT = 'CANCELEDBY_DONOTCOUNT'; final public const CANCELEDBY_DONOTCOUNT = 'CANCELEDBY_DONOTCOUNT';
@ -27,28 +25,19 @@ class CancelReason
final public const CANCELEDBY_USER = 'CANCELEDBY_USER'; final public const CANCELEDBY_USER = 'CANCELEDBY_USER';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
* @ORM\Column(type="boolean")
*/
private ?bool $active = null; private ?bool $active = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
* @ORM\Column(type="string", length=255)
*/
private ?string $canceledBy = null; private ?string $canceledBy = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
* @ORM\Column(type="json")
*/
private array $name = []; private array $name = [];
public function getActive(): ?bool public function getActive(): ?bool

View File

@ -25,13 +25,11 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* The event/calendar in the user may have a different id than the mainUser. We add then fields to store the * The event/calendar in the user may have a different id than the mainUser. We add then fields to store the
* remote id of this event in the remote calendar. * remote id of this event in the remote calendar.
* *
* @ORM\Table(
* name="chill_calendar.invite",
* uniqueConstraints={@ORM\UniqueConstraint(name="idx_calendar_invite_remote", columns={"remoteId"}, options={"where": "remoteId <> ''"})}
* )
* *
* @ORM\Entity
*/ */
#[ORM\Entity]
#[ORM\Table(name: 'chill_calendar.invite')]
#[ORM\UniqueConstraint(name: 'idx_calendar_invite_remote', columns: ['remoteId'], options: ['where' => "remoteId <> ''"])]
class Invite implements TrackUpdateInterface, TrackCreationInterface class Invite implements TrackUpdateInterface, TrackCreationInterface
{ {
use RemoteCalendarTrait; use RemoteCalendarTrait;
@ -58,33 +56,24 @@ class Invite implements TrackUpdateInterface, TrackCreationInterface
final public const TENTATIVELY_ACCEPTED = 'tentative'; final public const TENTATIVELY_ACCEPTED = 'tentative';
/** #[ORM\ManyToOne(targetEntity: Calendar::class, inversedBy: 'invites')]
* @ORM\ManyToOne(targetEntity=Calendar::class, inversedBy="invites")
*/
private ?Calendar $calendar = null; private ?Calendar $calendar = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(groups: ['calendar:read', 'read'])] #[Serializer\Groups(groups: ['calendar:read', 'read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/**
* @ORM\Column(type="text", nullable=false, options={"default": "pending"})
*/
#[Serializer\Groups(groups: ['calendar:read', 'read', 'docgen:read'])] #[Serializer\Groups(groups: ['calendar:read', 'read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => 'pending'])]
private string $status = self::PENDING; private string $status = self::PENDING;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*
* @ORM\JoinColumn(nullable=false)
*/
#[Serializer\Groups(groups: ['calendar:read', 'read', 'docgen:read'])] #[Serializer\Groups(groups: ['calendar:read', 'read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)]
#[ORM\JoinColumn(nullable: false)]
private ?User $user = null; private ?User $user = null;
public function getCalendar(): ?Calendar public function getCalendar(): ?Calendar

View File

@ -30,14 +30,10 @@ trait RemoteCalendarTrait
*/ */
public bool $preventEnqueueChanges = false; public bool $preventEnqueueChanges = false;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '[]'], nullable: false)]
* @ORM\Column(type="json", options={"default": "[]"}, nullable=false)
*/
private array $remoteAttributes = []; private array $remoteAttributes = [];
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => ''], nullable: false)]
* @ORM\Column(type="text", options={"default": ""}, nullable=false)
*/
private string $remoteId = ''; private string $remoteId = '';
public function addRemoteAttributes(array $remoteAttributes): self public function addRemoteAttributes(array $remoteAttributes): self

View File

@ -16,69 +16,49 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* CustomField. * CustomField.
* *
* @ORM\Entity
* *
* @ORM\Table(name="customfield")
* *
* @ORM\HasLifecycleCallbacks
*/ */
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'customfield')]
class CustomField class CustomField
{ {
final public const ONE_TO_MANY = 2; final public const ONE_TO_MANY = 2;
final public const ONE_TO_ONE = 1; final public const ONE_TO_ONE = 1;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
* @ORM\Column(type="boolean")
*/
private bool $active = true; private bool $active = true;
/** #[ORM\ManyToOne(targetEntity: \Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class, inversedBy: 'customFields')]
* @ORM\ManyToOne(
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldsGroup",
* inversedBy="customFields")
*/
private ?CustomFieldsGroup $customFieldGroup = null; private ?CustomFieldsGroup $customFieldGroup = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(name="id", type="integer") #[ORM\GeneratedValue(strategy: 'AUTO')]
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null; private ?int $id = null;
/** /**
* @var array * @var array
*
* @ORM\Column(type="json")
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private $name; private $name;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
* @ORM\Column(type="json")
*/
private array $options = []; private array $options = [];
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
* @ORM\Column(type="float")
*/
private ?float $ordering = null; private ?float $ordering = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
* @ORM\Column(type="boolean")
*/
private false $required = false; private false $required = false;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
* @ORM\Column(type="string", length=255)
*/
private ?string $slug = null; private ?string $slug = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
* @ORM\Column(type="string", length=255)
*/
private ?string $type = null; private ?string $type = null;
/** /**

View File

@ -15,61 +15,41 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity( #[ORM\Entity(repositoryClass: \Chill\CustomFieldsBundle\EntityRepository\CustomFieldLongChoice\OptionRepository::class)]
* repositoryClass="Chill\CustomFieldsBundle\EntityRepository\CustomFieldLongChoice\OptionRepository") #[ORM\Table(name: 'custom_field_long_choice_options')]
*
* @ORM\Table(name="custom_field_long_choice_options")
*/
class Option class Option
{ {
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
* @ORM\Column(type="boolean")
*/
private bool $active = true; private bool $active = true;
/** /**
* @var Collection<Option> * @var Collection<Option>
*
* @ORM\OneToMany(
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option",
* mappedBy="parent")
*/ */
#[ORM\OneToMany(targetEntity: \Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option::class, mappedBy: 'parent')]
private Collection $children; private Collection $children;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(name="id", type="integer") #[ORM\GeneratedValue(strategy: 'AUTO')]
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 50, name: 'internal_key')]
* @ORM\Column(type="string", length=50, name="internal_key")
*/
private string $internalKey = ''; private string $internalKey = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 15)]
* @ORM\Column(type="string", length=15)
*/
private ?string $key = null; private ?string $key = null;
/**
* @ORM\ManyToOne( #[ORM\ManyToOne(targetEntity: \Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option::class, inversedBy: 'children')]
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option", #[ORM\JoinColumn(nullable: true)]
* inversedBy="children")
*
* @ORM\JoinColumn(nullable=true)
*/
private ?Option $parent = null; private ?Option $parent = null;
/** /**
* A json representation of text (multilingual). * A json representation of text (multilingual).
*
* @ORM\Column(type="json")
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private ?array $text = null; private ?array $text = null;
public function __construct() public function __construct()

View File

@ -16,37 +16,23 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* CustomFieldsDefaultGroup. * CustomFieldsDefaultGroup.
* *
* @ORM\Entity
* *
* @ORM\Table(
* name="customfieldsdefaultgroup",
* uniqueConstraints={@ORM\UniqueConstraint(
* name="unique_entity",
* columns={"entity"}
* )})
*/ */
#[ORM\Entity]
#[ORM\Table(name: 'customfieldsdefaultgroup')]
#[ORM\UniqueConstraint(name: 'unique_entity', columns: ['entity'])]
class CustomFieldsDefaultGroup class CustomFieldsDefaultGroup
{ {
/** #[ORM\ManyToOne(targetEntity: \Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)] // sf4 check: option inversedBy="customFields" return inconsistent error mapping !!
* @ORM\ManyToOne(
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldsGroup")
*
* sf4 check: option inversedBy="customFields" return inconsistent error mapping !!
*/
private ?CustomFieldsGroup $customFieldsGroup = null; private ?CustomFieldsGroup $customFieldsGroup = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
* @ORM\Column(type="string", length=255)
*/
private ?string $entity = null; private ?string $entity = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(name="id", type="integer") #[ORM\GeneratedValue(strategy: 'AUTO')]
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null; private ?int $id = null;
/** /**

View File

@ -18,10 +18,10 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* CustomFieldGroup. * CustomFieldGroup.
* *
* @ORM\Entity
* *
* @ORM\Table(name="customfieldsgroup")
*/ */
#[ORM\Entity]
#[ORM\Table(name: 'customfieldsgroup')]
class CustomFieldsGroup class CustomFieldsGroup
{ {
/** /**
@ -36,38 +36,28 @@ class CustomFieldsGroup
* *
* @var Collection<CustomField> * @var Collection<CustomField>
* *
* @ORM\OneToMany(
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomField",
* mappedBy="customFieldGroup")
* *
* @ORM\OrderBy({"ordering": "ASC"})
*/ */
#[ORM\OneToMany(targetEntity: \Chill\CustomFieldsBundle\Entity\CustomField::class, mappedBy: 'customFieldGroup')]
#[ORM\OrderBy(['ordering' => \Doctrine\Common\Collections\Criteria::ASC])]
private Collection $customFields; private Collection $customFields;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
* @ORM\Column(type="string", length=255)
*/
private ?string $entity = null; private ?string $entity = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(name="id", type="integer") #[ORM\GeneratedValue(strategy: 'AUTO')]
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null; private ?int $id = null;
/** /**
* @var array * @var array
*
* @ORM\Column(type="json")
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private $name; private $name;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
* @ORM\Column(type="json")
*/
private array $options = []; private array $options = [];
/** /**

View File

@ -15,17 +15,13 @@ use Chill\DocStoreBundle\Entity\StoredObject;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
/**
* @ORM\Entity
*
* @ORM\Table(name="chill_docgen_template")
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['docgen_template' => DocGeneratorTemplate::class])] #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['docgen_template' => DocGeneratorTemplate::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_docgen_template')]
class DocGeneratorTemplate class DocGeneratorTemplate
{ {
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => true])]
* @ORM\Column(type="boolean", options={"default": true})
*/
private bool $active = true; private bool $active = true;
/** /**
@ -33,50 +29,38 @@ class DocGeneratorTemplate
* *
* so if $context = '' * so if $context = ''
* this template will use '' as context * this template will use '' as context
*
* @ORM\Column(type="string", length=255)
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
private string $context; private string $context;
/**
* @ORM\Column(type="text", nullable=true)
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
private ?string $description = null; private ?string $description = null;
/** /**
* Class name of the entity for which this template can be used. * Class name of the entity for which this template can be used.
*
* @ORM\Column(type="string", options={"default": ""})
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, options: ['default' => ''])]
private string $entity = ''; private string $entity = '';
/** #[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
* @ORM\ManyToOne(targetEntity=StoredObject::class, cascade={"persist"}))
*/
private ?StoredObject $file = null; private ?StoredObject $file = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/**
* @ORM\Column(type="json")
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $name = []; private array $name = [];
/** /**
* Options for the template. * Options for the template.
*
* @ORM\Column(type="json", name="template_options", options={"default":"[]"})
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, name: 'template_options', options: ['default' => '[]'])]
private array $options = []; private array $options = [];
public function getContext(): ?string public function getContext(): ?string

View File

@ -16,27 +16,20 @@ use Chill\MainBundle\Entity\HasScopesInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Table('chill_doc.accompanyingcourse_document')]
* @ORM\Table("chill_doc.accompanyingcourse_document")
*/
class AccompanyingCourseDocument extends Document implements HasScopesInterface, HasCentersInterface class AccompanyingCourseDocument extends Document implements HasScopesInterface, HasCentersInterface
{ {
/**
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class) #[ORM\ManyToOne(targetEntity: AccompanyingPeriod::class)]
* #[ORM\JoinColumn(nullable: false)]
* @ORM\JoinColumn(nullable=false)
*/
private ?AccompanyingPeriod $course = null; private ?AccompanyingPeriod $course = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
public function getCenters(): ?iterable public function getCenters(): ?iterable

View File

@ -19,60 +19,38 @@ use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
/** #[ORM\MappedSuperclass]
* @ORM\MappedSuperclass
*/
class Document implements TrackCreationInterface, TrackUpdateInterface class Document implements TrackCreationInterface, TrackUpdateInterface
{ {
use TrackCreationTrait; use TrackCreationTrait;
use TrackUpdateTrait; use TrackUpdateTrait;
/**
* @ORM\ManyToOne(targetEntity="Chill\DocStoreBundle\Entity\DocumentCategory") #[ORM\ManyToOne(targetEntity: \Chill\DocStoreBundle\Entity\DocumentCategory::class)]
* #[ORM\JoinColumn(name: 'category_bundle_id', referencedColumnName: 'bundle_id')]
* @ORM\JoinColumns({ #[ORM\JoinColumn(name: 'category_id_inside_bundle', referencedColumnName: 'id_inside_bundle')]
*
* @ORM\JoinColumn(name="category_bundle_id", referencedColumnName="bundle_id"),
* @ORM\JoinColumn(name="category_id_inside_bundle", referencedColumnName="id_inside_bundle")
* })
*/
private ?DocumentCategory $category = null; private ?DocumentCategory $category = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)]
* @ORM\Column(type="datetime")
*/
private ?\DateTimeInterface $date = null; private ?\DateTimeInterface $date = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
* @ORM\Column(type="text")
*/
private string $description = ''; private string $description = '';
/**
* @ORM\ManyToOne(
* targetEntity="Chill\DocStoreBundle\Entity\StoredObject",
* cascade={"persist"}
* )
*/
#[Assert\Valid] #[Assert\Valid]
#[Assert\NotNull(message: 'Upload a document')] #[Assert\NotNull(message: 'Upload a document')]
#[ORM\ManyToOne(targetEntity: \Chill\DocStoreBundle\Entity\StoredObject::class, cascade: ['persist'])]
private ?StoredObject $object = null; private ?StoredObject $object = null;
/** #[ORM\ManyToOne(targetEntity: \Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate::class)]
* @ORM\ManyToOne(targetEntity="Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate")
*/
private ?DocGeneratorTemplate $template = null; private ?DocGeneratorTemplate $template = null;
/**
* @ORM\Column(type="text")
*/
#[Assert\Length(min: 2, max: 250)] #[Assert\Length(min: 2, max: 250)]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
private string $title = ''; private string $title = '';
/** #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)]
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*/
private ?\Chill\MainBundle\Entity\User $user = null; private ?\Chill\MainBundle\Entity\User $user = null;
public function getCategory(): ?DocumentCategory public function getCategory(): ?DocumentCategory

View File

@ -13,23 +13,18 @@ namespace Chill\DocStoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table("chill_doc.document_category") #[ORM\Entity]
* #[ORM\Table('chill_doc.document_category')]
* @ORM\Entity
*/
class DocumentCategory class DocumentCategory
{ {
/** /**
* @ORM\Column(type="string", name="document_class")
*
* @var string The class of the document (ie Chill\DocStoreBundle\PersonDocument) * @var string The class of the document (ie Chill\DocStoreBundle\PersonDocument)
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'document_class')]
private ?string $documentClass = null; private ?string $documentClass = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
* @ORM\Column(type="json")
*/
private $name; private $name;
/** /**
@ -38,20 +33,20 @@ class DocumentCategory
*/ */
public function __construct( public function __construct(
/** /**
* @ORM\Id
* *
* @ORM\Column(type="string", name="bundle_id")
* *
* @var string The id of the bundle that has create the category (i.e. 'person', 'activity', ....) * @var string The id of the bundle that has create the category (i.e. 'person', 'activity', ....)
*/ */
#[ORM\Id]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'bundle_id')]
private $bundleId, private $bundleId,
/** /**
* @ORM\Id
* *
* @ORM\Column(type="integer", name="id_inside_bundle")
* *
* @var int The id which is unique inside the bundle * @var int The id which is unique inside the bundle
*/ */
#[ORM\Id]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, name: 'id_inside_bundle')]
private $idInsideBundle private $idInsideBundle
) {} ) {}

View File

@ -17,32 +17,24 @@ use Chill\MainBundle\Entity\Scope;
use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\Person;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table("chill_doc.person_document") #[ORM\Entity]
* #[ORM\Table('chill_doc.person_document')]
* @ORM\Entity
*/
class PersonDocument extends Document implements HasCenterInterface, HasScopeInterface class PersonDocument extends Document implements HasCenterInterface, HasScopeInterface
{ {
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\Person::class)]
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
*/
private Person $person; private Person $person;
/** /**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
*
* @var Scope The document's center * @var Scope The document's center
*/ */
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Scope::class)]
private ?Scope $scope = null; private ?Scope $scope = null;
public function getCenter() public function getCenter()

View File

@ -29,14 +29,14 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* The property `$deleteAt` allow a deletion of the document after the given date. But this property should * The property `$deleteAt` allow a deletion of the document after the given date. But this property should
* be set before the document is actually written by the StoredObjectManager. * be set before the document is actually written by the StoredObjectManager.
* *
* @ORM\Entity
* *
* @ORM\Table("chill_doc.stored_object")
* *
* @AsyncFileExists( * @AsyncFileExists(
* message="The file is not stored properly" * message="The file is not stored properly"
* ) * )
*/ */
#[ORM\Entity]
#[ORM\Table('chill_doc.stored_object')]
class StoredObject implements Document, TrackCreationInterface class StoredObject implements Document, TrackCreationInterface
{ {
use TrackCreationTrait; use TrackCreationTrait;
@ -44,63 +44,45 @@ class StoredObject implements Document, TrackCreationInterface
final public const STATUS_PENDING = 'pending'; final public const STATUS_PENDING = 'pending';
final public const STATUS_FAILURE = 'failure'; final public const STATUS_FAILURE = 'failure';
/**
* @ORM\Column(type="json", name="datas")
*/
#[Serializer\Groups(['read', 'write'])] #[Serializer\Groups(['read', 'write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, name: 'datas')]
private array $datas = []; private array $datas = [];
/**
* @ORM\Column(type="text")
*/
#[Serializer\Groups(['read', 'write'])] #[Serializer\Groups(['read', 'write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
private string $filename = ''; private string $filename = '';
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read', 'write'])] #[Serializer\Groups(['read', 'write'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/** /**
* @var int[] * @var int[]
*
* @ORM\Column(type="json", name="iv")
*/ */
#[Serializer\Groups(['read', 'write'])] #[Serializer\Groups(['read', 'write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, name: 'iv')]
private array $iv = []; private array $iv = [];
/**
* @ORM\Column(type="json", name="key")
*/
#[Serializer\Groups(['read', 'write'])] #[Serializer\Groups(['read', 'write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, name: 'key')]
private array $keyInfos = []; private array $keyInfos = [];
/**
* @ORM\Column(type="text", name="title")
*/
#[Serializer\Groups(['read', 'write'])] #[Serializer\Groups(['read', 'write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, name: 'title')]
private string $title = ''; private string $title = '';
/**
* @ORM\Column(type="text", name="type", options={"default": ""})
*/
#[Serializer\Groups(['read', 'write'])] #[Serializer\Groups(['read', 'write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, name: 'type', options: ['default' => ''])]
private string $type = ''; private string $type = '';
/**
* @ORM\Column(type="uuid", unique=true)
*/
#[Serializer\Groups(['read', 'write'])] #[Serializer\Groups(['read', 'write'])]
#[ORM\Column(type: 'uuid', unique: true)]
private UuidInterface $uuid; private UuidInterface $uuid;
/** #[ORM\ManyToOne(targetEntity: DocGeneratorTemplate::class)]
* @ORM\ManyToOne(targetEntity=DocGeneratorTemplate::class)
*/
private ?DocGeneratorTemplate $template = null; private ?DocGeneratorTemplate $template = null;
/** /**
@ -108,28 +90,20 @@ class StoredObject implements Document, TrackCreationInterface
* *
* This is a workaround, as generation consume lot of memory, and out-of-memory errors * This is a workaround, as generation consume lot of memory, and out-of-memory errors
* are not handled by messenger. * are not handled by messenger.
*
* @ORM\Column(type="integer", options={"default": 0})
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, options: ['default' => 0])]
private int $generationTrialsCounter = 0; private int $generationTrialsCounter = 0;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true, options: ['default' => null])]
* @ORM\Column(type="datetime_immutable", nullable=true, options={"default": null})
*/
private ?\DateTimeImmutable $deleteAt = null; private ?\DateTimeImmutable $deleteAt = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
private string $generationErrors = ''; private string $generationErrors = '';
/** /**
* @param StoredObject::STATUS_* $status * @param StoredObject::STATUS_* $status
*/ */
public function __construct(/** public function __construct(#[Serializer\Groups(['read'])] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => 'ready'])]
* @ORM\Column(type="text", options={"default": "ready"})
*/
#[Serializer\Groups(['read'])]
private string $status = 'ready' private string $status = 'ready'
) { ) {
$this->uuid = Uuid::uuid4(); $this->uuid = Uuid::uuid4();

View File

@ -37,6 +37,7 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
@ -110,13 +111,9 @@ final class EventController extends AbstractController
/** /**
* Displays a form to edit an existing Event entity. * Displays a form to edit an existing Event entity.
* *
* @return \Symfony\Component\HttpFoundation\Response
* @return \Symfony\Component\HttpFoundation\Response
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/edit", name="chill_event__event_edit")
*/ */
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/edit', name: 'chill_event__event_edit')] #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/edit', name: 'chill_event__event_edit')]
public function editAction($event_id) public function editAction($event_id): Response
{ {
$em = $this->managerRegistry->getManager(); $em = $this->managerRegistry->getManager();
@ -140,12 +137,9 @@ final class EventController extends AbstractController
* @return \Symfony\Component\HttpFoundation\Response * @return \Symfony\Component\HttpFoundation\Response
* *
* @throws \Doctrine\ORM\NonUniqueResultException * @throws \Doctrine\ORM\NonUniqueResultException
* @throws \Doctrine\ORM\NonUniqueResultException
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{person_id}/list", name="chill_event__list_by_person", methods={"GET"})
*/ */
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{person_id}/list', name: 'chill_event__list_by_person', methods: ['GET'])] #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{person_id}/list', name: 'chill_event__list_by_person', methods: ['GET'])]
public function listByPersonAction($person_id) public function listByPersonAction($person_id): Response
{ {
$em = $this->managerRegistry->getManager(); $em = $this->managerRegistry->getManager();
@ -200,14 +194,9 @@ final class EventController extends AbstractController
/** /**
* Displays a form to create a new Event entity. * Displays a form to create a new Event entity.
*
* @return \Symfony\Component\HttpFoundation\Response
* @return \Symfony\Component\HttpFoundation\Response
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/new", name="chill_event__event_new", methods={"GET", "POST"})
*/ */
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/new', name: 'chill_event__event_new', methods: ['GET', 'POST'])] #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/new', name: 'chill_event__event_new', methods: ['GET', 'POST'])]
public function newAction(?Center $center, Request $request) public function newAction(?Center $center, Request $request): Response
{ {
$user = $this->security->getUser(); $user = $this->security->getUser();
@ -248,7 +237,7 @@ final class EventController extends AbstractController
* First step of new Event form. * First step of new Event form.
*/ */
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/new/pick-center', name: 'chill_event__event_new_pickcenter', options: [null])] #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/new/pick-center', name: 'chill_event__event_new_pickcenter', options: [null])]
public function newPickCenterAction() public function newPickCenterAction(): Response
{ {
$role = 'CHILL_EVENT_CREATE'; $role = 'CHILL_EVENT_CREATE';
@ -295,9 +284,7 @@ final class EventController extends AbstractController
* @return \Symfony\Component\HttpFoundation\Response * @return \Symfony\Component\HttpFoundation\Response
* *
* @throws \PhpOffice\PhpSpreadsheet\Exception * @throws \PhpOffice\PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
* *
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/show", name="chill_event__event_show")
*/ */
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/show', name: 'chill_event__event_show')] #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/show', name: 'chill_event__event_show')]
public function showAction(Event $event, Request $request) public function showAction(Event $event, Request $request)
@ -370,7 +357,7 @@ final class EventController extends AbstractController
$builder = $this $builder = $this
->formFactoryInterface ->formFactoryInterface
->createNamedBuilder( ->createNamedBuilder(
null, '',
FormType::class, FormType::class,
null, null,
[ [

View File

@ -289,9 +289,7 @@ final class ParticipationController extends AbstractController
* *
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException if the participation is not found * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException if the participation is not found
* @throws \Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException if the user is not allowed to edit the participation * @throws \Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException if the user is not allowed to edit the participation
* @throws \Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException if the user is not allowed to edit the participation
* *
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{participation_id}/edit", name="chill_event_participation_edit")
*/ */
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{participation_id}/edit', name: 'chill_event_participation_edit')] #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{participation_id}/edit', name: 'chill_event_participation_edit')]
public function editAction(int $participation_id): Response public function editAction(int $participation_id): Response
@ -323,9 +321,7 @@ final class ParticipationController extends AbstractController
* show a form to edit multiple participation for the same event. * show a form to edit multiple participation for the same event.
* *
* @param int $event_id * @param int $event_id
* @param int $event_id
* *
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{event_id}/edit_multiple", name="chill_event_participation_edit_multiple")
*/ */
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{event_id}/edit_multiple', name: 'chill_event_participation_edit_multiple')] #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{event_id}/edit_multiple', name: 'chill_event_participation_edit_multiple')]
public function editMultipleAction($event_id): Response|\Symfony\Component\HttpFoundation\RedirectResponse public function editMultipleAction($event_id): Response|\Symfony\Component\HttpFoundation\RedirectResponse

View File

@ -32,92 +32,68 @@ use Symfony\Component\Validator\Constraints as Assert;
/** /**
* Class Event. * Class Event.
* *
* @ORM\Entity(repositoryClass="Chill\EventBundle\Repository\EventRepository")
* *
* @ORM\Table(name="chill_event_event")
* *
* @ORM\HasLifecycleCallbacks
*/ */
#[ORM\Entity(repositoryClass: \Chill\EventBundle\Repository\EventRepository::class)]
#[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'chill_event_event')]
class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInterface, TrackUpdateInterface class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInterface, TrackUpdateInterface
{ {
use TrackCreationTrait; use TrackCreationTrait;
use TrackUpdateTrait; use TrackUpdateTrait;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center")A
*/
#[Assert\NotNull] #[Assert\NotNull]
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Center::class)] // A
private ?Center $center = null; private ?Center $center = null;
/** #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Scope::class)]
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
*/
private ?Scope $circle = null; private ?Scope $circle = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)]
* @ORM\Column(type="datetime")
*/
private ?\DateTime $date; private ?\DateTime $date;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(name="id", type="integer") #[ORM\GeneratedValue(strategy: 'AUTO')]
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)]
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*/
private ?User $moderator = null; private ?User $moderator = null;
/**
* @ORM\Column(type="string", length=150)
*/
#[Assert\NotBlank] #[Assert\NotBlank]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 150)]
private ?string $name = null; private ?string $name = null;
/** /**
* @var Collection<Participation> * @var Collection<Participation>
*
* @ORM\OneToMany(
* targetEntity="Chill\EventBundle\Entity\Participation",
* mappedBy="event")
*/ */
#[ORM\OneToMany(targetEntity: \Chill\EventBundle\Entity\Participation::class, mappedBy: 'event')]
private Collection $participations; private Collection $participations;
/**
* @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\EventType")
*/
#[Assert\NotNull] #[Assert\NotNull]
#[ORM\ManyToOne(targetEntity: \Chill\EventBundle\Entity\EventType::class)]
private ?EventType $type = null; private ?EventType $type = null;
/** #[ORM\Embedded(class: CommentEmbeddable::class, columnPrefix: 'comment_')]
* @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_")
*/
private CommentEmbeddable $comment; private CommentEmbeddable $comment;
/**
* @ORM\ManyToOne(targetEntity=Location::class) #[ORM\ManyToOne(targetEntity: Location::class)]
* #[ORM\JoinColumn(nullable: true)]
* @ORM\JoinColumn(nullable=true)
*/
private ?Location $location = null; private ?Location $location = null;
/** /**
* @var Collection<StoredObject> * @var Collection<StoredObject>
* *
* @ORM\ManyToMany(targetEntity=StoredObject::class, cascade={"persist","refresh"})
* *
* @ORM\JoinTable("chill_event_event_documents")
*/ */
#[ORM\ManyToMany(targetEntity: StoredObject::class, cascade: ['persist', 'refresh'])]
#[ORM\JoinTable('chill_event_event_documents')]
private Collection $documents; private Collection $documents;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DECIMAL, precision: 10, scale: 4, nullable: true, options: ['default' => null])]
* @ORM\Column(type="decimal", precision=10, scale=4, nullable=true, options={"default": null})
*/
private string $organizationCost = '0.0'; private string $organizationCost = '0.0';
/** /**

View File

@ -18,51 +18,39 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* Class EventType. * Class EventType.
* *
* @ORM\Entity
* *
* @ORM\Table(name="chill_event_event_type")
* *
* @ORM\HasLifecycleCallbacks
*/ */
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'chill_event_event_type')]
class EventType class EventType
{ {
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: false)]
* @ORM\Column(type="boolean", nullable=false)
*/
private bool $active = true; private bool $active = true;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(name="id", type="integer") #[ORM\GeneratedValue(strategy: 'AUTO')]
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null; private ?int $id = null;
/** /**
* @var array * @var array
*
* @ORM\Column(type="json")
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private $name; private $name;
/** /**
* @var Collection<Role> * @var Collection<Role>
*
* @ORM\OneToMany(
* targetEntity="Chill\EventBundle\Entity\Role",
* mappedBy="type")
*/ */
#[ORM\OneToMany(targetEntity: \Chill\EventBundle\Entity\Role::class, mappedBy: 'type')]
private Collection $roles; private Collection $roles;
/** /**
* @var Collection<Status> * @var Collection<Status>
*
* @ORM\OneToMany(
* targetEntity="Chill\EventBundle\Entity\Status",
* mappedBy="type")
*/ */
#[ORM\OneToMany(targetEntity: \Chill\EventBundle\Entity\Status::class, mappedBy: 'type')]
private Collection $statuses; private Collection $statuses;
/** /**

View File

@ -27,55 +27,39 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
/** /**
* Class Participation. * Class Participation.
* *
* @ORM\Entity(
* repositoryClass="Chill\EventBundle\Repository\ParticipationRepository")
* *
* @ORM\Table(name="chill_event_participation", uniqueConstraints={
* *
* @ORM\UniqueConstraint(name="chill_event_participation_event_person_unique_idx", columns={"event_id", "person_id"})
* })
* @ORM\UniqueConstraint(name="chill_event_participation_event_person_unique_idx", columns={"event_id", "person_id"})
* })
*
* @ORM\HasLifecycleCallbacks
*/ */
#[UniqueEntity(['event', 'person'], message: 'event.validation.person_already_participate_to_event')] #[UniqueEntity(['event', 'person'], message: 'event.validation.person_already_participate_to_event')]
#[ORM\Entity(repositoryClass: \Chill\EventBundle\Repository\ParticipationRepository::class)]
#[ORM\UniqueConstraint(name: 'chill_event_participation_event_person_unique_idx', columns: ['event_id', 'person_id'])] // @ORM\HasLifecycleCallbacks
#[ORM\Table(name: 'chill_event_participation')]
#[ORM\UniqueConstraint(name: 'chill_event_participation_event_person_unique_idx', columns: ['event_id', 'person_id'])]
#[ORM\UniqueConstraint(name: 'chill_event_participation_event_person_unique_idx', columns: ['event_id', 'person_id'])]
#[ORM\HasLifecycleCallbacks] // @ORM\HasLifecycleCallbacks
class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterface, TrackUpdateInterface, TrackCreationInterface class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterface, TrackUpdateInterface, TrackCreationInterface
{ {
use TrackCreationTrait; use TrackCreationTrait;
use TrackUpdateTrait; use TrackUpdateTrait;
/** #[ORM\ManyToOne(targetEntity: \Chill\EventBundle\Entity\Event::class, inversedBy: 'participations')]
* @ORM\ManyToOne(
* targetEntity="Chill\EventBundle\Entity\Event",
* inversedBy="participations")
*/
private ?Event $event = null; private ?Event $event = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(name="id", type="integer") #[ORM\GeneratedValue(strategy: 'AUTO')]
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null; private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
*/
#[Assert\NotNull] #[Assert\NotNull]
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\Person::class)]
private ?Person $person = null; private ?Person $person = null;
/** #[ORM\ManyToOne(targetEntity: \Chill\EventBundle\Entity\Role::class)]
* @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\Role")
*/
private ?Role $role = null; private ?Role $role = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\Status")
*/
#[Assert\NotNull] #[Assert\NotNull]
#[ORM\ManyToOne(targetEntity: \Chill\EventBundle\Entity\Status::class)]
private ?Status $status = null; private ?Status $status = null;
public function getCenter() public function getCenter()

View File

@ -16,40 +16,30 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* Class Role. * Class Role.
* *
* @ORM\Entity
* *
* @ORM\Table(name="chill_event_role")
* *
* @ORM\HasLifecycleCallbacks
*/ */
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'chill_event_role')]
class Role class Role
{ {
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: false)]
* @ORM\Column(type="boolean", nullable=false)
*/
private bool $active = true; private bool $active = true;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(name="id", type="integer") #[ORM\GeneratedValue(strategy: 'AUTO')]
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null; private ?int $id = null;
/** /**
* @var array * @var array
*
* @ORM\Column(type="json")
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private $name; private $name;
/** #[ORM\ManyToOne(targetEntity: \Chill\EventBundle\Entity\EventType::class, inversedBy: 'roles')]
* @ORM\ManyToOne(
* targetEntity="Chill\EventBundle\Entity\EventType",
* inversedBy="roles")
*/
private ?EventType $type = null; private ?EventType $type = null;
/** /**

View File

@ -16,40 +16,30 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* Class Status. * Class Status.
* *
* @ORM\Entity
* *
* @ORM\Table(name="chill_event_status")
* *
* @ORM\HasLifecycleCallbacks
*/ */
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'chill_event_status')]
class Status class Status
{ {
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: false)]
* @ORM\Column(type="boolean", nullable=false)
*/
private bool $active = true; private bool $active = true;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(name="id", type="integer") #[ORM\GeneratedValue(strategy: 'AUTO')]
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null; private ?int $id = null;
/** /**
* @var array * @var array
*
* @ORM\Column(type="json")
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private $name; private $name;
/** #[ORM\ManyToOne(targetEntity: \Chill\EventBundle\Entity\EventType::class, inversedBy: 'statuses')]
* @ORM\ManyToOne(
* targetEntity="Chill\EventBundle\Entity\EventType",
* inversedBy="statuses")
*/
private ?EventType $type = null; private ?EventType $type = null;
/** /**

View File

@ -106,13 +106,10 @@ class ExportController extends AbstractController
* *
* @param string $alias * @param string $alias
* *
* @return Response
* @return Response
* *
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/generate/{alias}", name="chill_main_export_generate", methods={"GET"})
*/ */
#[Route(path: '/{_locale}/exports/generate/{alias}', name: 'chill_main_export_generate', methods: ['GET'])] #[Route(path: '/{_locale}/exports/generate/{alias}', name: 'chill_main_export_generate', methods: ['GET'])]
public function generateAction(Request $request, $alias) public function generateAction(Request $request, $alias): Response
{ {
/** @var ExportManager $exportManager */ /** @var ExportManager $exportManager */
$exportManager = $this->exportManager; $exportManager = $this->exportManager;

View File

@ -35,12 +35,10 @@ class LoginController extends AbstractController
* Show a login form. * Show a login form.
* *
* @return Response * @return Response
* @return Response
* *
* @\Symfony\Component\Routing\Annotation\Route(path="/login", name="login")
*/ */
#[\Symfony\Component\Routing\Annotation\Route(path: '/login', name: 'login')] #[\Symfony\Component\Routing\Annotation\Route(path: '/login', name: 'login')]
public function loginAction(Request $request) public function loginAction(Request $request): Response
{ {
return $this->render('@ChillMain/Login/login.html.twig', [ return $this->render('@ChillMain/Login/login.html.twig', [
'last_username' => $this->helper->getLastUsername(), 'last_username' => $this->helper->getLastUsername(),

View File

@ -116,9 +116,7 @@ final class PasswordController extends AbstractController
/** /**
* @throws \Doctrine\ORM\NoResultException * @throws \Doctrine\ORM\NoResultException
* @throws \Doctrine\ORM\NonUniqueResultException * @throws \Doctrine\ORM\NonUniqueResultException
* @throws \Doctrine\ORM\NonUniqueResultException
* *
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-recover", name="password_request_recover")
*/ */
#[Route(path: '/public/{_locale}/password/request-recover', name: 'password_request_recover')] #[Route(path: '/public/{_locale}/password/request-recover', name: 'password_request_recover')]
public function requestRecoverAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse public function requestRecoverAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse

View File

@ -18,18 +18,14 @@ use Symfony\Component\Serializer\Annotation as Serializer;
trait TrackCreationTrait trait TrackCreationTrait
{ {
/**
* @ORM\Column(type="datetime_immutable", nullable=true, options={"default": NULL})
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $createdAt = null; private ?\DateTimeImmutable $createdAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=true)
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: true)]
private ?User $createdBy = null; private ?User $createdBy = null;
public function getCreatedAt(): ?\DateTimeInterface public function getCreatedAt(): ?\DateTimeInterface

View File

@ -18,18 +18,14 @@ use Symfony\Component\Serializer\Annotation as Serializer;
trait TrackUpdateTrait trait TrackUpdateTrait
{ {
/**
* @ORM\Column(type="datetime_immutable", nullable=true, options={"default": NULL})
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $updatedAt = null; private ?\DateTimeImmutable $updatedAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=true)
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: true)]
private ?User $updatedBy = null; private ?User $updatedBy = null;
public function getUpdatedAt(): ?\DateTimeInterface public function getUpdatedAt(): ?\DateTimeInterface

View File

@ -27,12 +27,12 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
/** /**
* Address. * Address.
* *
* @ORM\Entity
* *
* @ORM\Table(name="chill_main_address")
* *
* @ORM\HasLifecycleCallbacks
*/ */
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'chill_main_address')]
class Address implements TrackCreationInterface, TrackUpdateInterface class Address implements TrackCreationInterface, TrackUpdateInterface
{ {
use TrackCreationTrait; use TrackCreationTrait;
@ -55,54 +55,39 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
*/ */
final public const ADDR_REFERENCE_STATUS_REVIEWED = 'reviewed'; final public const ADDR_REFERENCE_STATUS_REVIEWED = 'reviewed';
/**
* @ORM\ManyToOne(targetEntity=AddressReference::class)
*/
#[Groups(['write'])] #[Groups(['write'])]
#[ORM\ManyToOne(targetEntity: AddressReference::class)]
private ?AddressReference $addressReference = null; private ?AddressReference $addressReference = null;
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Groups(['write'])] #[Groups(['write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $buildingName = ''; private string $buildingName = '';
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
#[Groups(['write'])] #[Groups(['write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
private bool $confidential = false; private bool $confidential = false;
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Groups(['write'])] #[Groups(['write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $corridor = ''; private string $corridor = '';
/** /**
* used for the CEDEX information. * used for the CEDEX information.
*
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/ */
#[Groups(['write'])] #[Groups(['write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $distribution = ''; private string $distribution = '';
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Groups(['write'])] #[Groups(['write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $extra = ''; private string $extra = '';
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Groups(['write'])] #[Groups(['write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $flat = ''; private string $flat = '';
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Groups(['write'])] #[Groups(['write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $floor = ''; private string $floor = '';
/** /**
@ -115,108 +100,89 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
* *
* @readonly * @readonly
* *
* @ORM\ManyToMany(targetEntity=GeographicalUnit::class)
* *
* @ORM\JoinTable(
* name="view_chill_main_address_geographical_unit",
* joinColumns={@ORM\JoinColumn(name="address_id")},
* inverseJoinColumns={@ORM\JoinColumn(name="geographical_unit_id")}
* )
*/ */
#[ORM\ManyToMany(targetEntity: GeographicalUnit::class)]
#[ORM\JoinTable(name: 'view_chill_main_address_geographical_unit', joinColumns: [new ORM\JoinColumn(name: 'address_id')], inverseJoinColumns: [new ORM\JoinColumn(name: 'geographical_unit_id')])]
private Collection $geographicalUnits; private Collection $geographicalUnits;
/** /**
* @ORM\Id
* *
* @ORM\Column(name="id", type="integer")
* *
* @ORM\GeneratedValue(strategy="AUTO")
* *
* @readonly * @readonly
*/ */
#[Groups(['write'])] #[Groups(['write'])]
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null; private ?int $id = null;
/** /**
* True if the address is a "no address", aka homeless person, ... * True if the address is a "no address", aka homeless person, ...
*
* @ORM\Column(type="boolean", options={"default": false})
*/ */
#[Groups(['write'])] #[Groups(['write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
private bool $isNoAddress = false; private bool $isNoAddress = false;
/** /**
* A ThirdParty reference for person's addresses that are linked to a third party. * A ThirdParty reference for person's addresses that are linked to a third party.
* *
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
* *
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/ */
#[Groups(['write'])] #[Groups(['write'])]
#[ORM\ManyToOne(targetEntity: \Chill\ThirdPartyBundle\Entity\ThirdParty::class)]
#[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')]
private ?ThirdParty $linkedToThirdParty = null; private ?ThirdParty $linkedToThirdParty = null;
/** /**
* A geospatial field storing the coordinates of the Address. * A geospatial field storing the coordinates of the Address.
*
* @ORM\Column(type="point", nullable=true)
*/ */
#[Groups(['write'])] #[Groups(['write'])]
#[ORM\Column(type: 'point', nullable: true)]
private ?Point $point = null; private ?Point $point = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode")
*
* @ORM\JoinColumn(nullable=false)
*/
#[Groups(['write'])] #[Groups(['write'])]
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\PostalCode::class)]
#[ORM\JoinColumn(nullable: false)]
private ?PostalCode $postcode = null; private ?PostalCode $postcode = null;
/** /**
* @var self::ADDR_REFERENCE_STATUS_* * @var self::ADDR_REFERENCE_STATUS_*
*
* @ORM\Column(type="text", nullable=false, options={"default": self::ADDR_REFERENCE_STATUS_MATCH})
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => self::ADDR_REFERENCE_STATUS_MATCH])]
private string $refStatus = self::ADDR_REFERENCE_STATUS_MATCH; private string $refStatus = self::ADDR_REFERENCE_STATUS_MATCH;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false, options: ['default' => 'CURRENT_TIMESTAMP'])]
* @ORM\Column(type="datetime_immutable", nullable=false, options={"default": "CURRENT_TIMESTAMP"})
*/
private \DateTimeImmutable $refStatusLastUpdate; private \DateTimeImmutable $refStatusLastUpdate;
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Groups(['write'])] #[Groups(['write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $steps = ''; private string $steps = '';
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Groups(['write'])] #[Groups(['write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $street = ''; private string $street = '';
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Groups(['write'])] #[Groups(['write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $streetNumber = ''; private string $streetNumber = '';
/** /**
* Indicates when the address starts validation. Used to build an history * Indicates when the address starts validation. Used to build an history
* of address. By default, the current date. * of address. By default, the current date.
*
* @ORM\Column(type="date")
*/ */
#[Groups(['write'])] #[Groups(['write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE)]
private \DateTime $validFrom; private \DateTime $validFrom;
/** /**
* Indicates when the address ends. Used to build an history * Indicates when the address ends. Used to build an history
* of address. * of address.
*
* @ORM\Column(type="date", nullable=true)
*/ */
#[Groups(['write'])] #[Groups(['write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)]
private ?\DateTime $validTo = null; private ?\DateTime $validTo = null;
public function __construct() public function __construct()

View File

@ -15,101 +15,70 @@ use Chill\MainBundle\Doctrine\Model\Point;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\HasLifecycleCallbacks]
* @ORM\Table(name="chill_main_address_reference", indexes={ #[ORM\Table(name: 'chill_main_address_reference')]
* #[ORM\Index(name: 'address_refid', columns: ['refId'])]
* @ORM\Index(name="address_refid", columns={"refId"}) #[ORM\UniqueConstraint(name: 'chill_main_address_reference_unicity', columns: ['refId', 'source'])]
* },
* uniqueConstraints={
*
* @ORM\UniqueConstraint(name="chill_main_address_reference_unicity", columns={"refId", "source"})
* })
*
* @ORM\HasLifecycleCallbacks
*/
class AddressReference class AddressReference
{ {
/** /**
* This is an internal column which is populated by database. * This is an internal column which is populated by database.
* *
* This column will ease the search operations * This column will ease the search operations
*
* @ORM\Column(type="text", options={"default": ""})
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => ''])]
private string $addressCanonical = ''; private string $addressCanonical = '';
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)]
private ?\DateTimeImmutable $createdAt = null; private ?\DateTimeImmutable $createdAt = null;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)]
private ?\DateTimeImmutable $deletedAt = null; private ?\DateTimeImmutable $deletedAt = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $municipalityCode = ''; private string $municipalityCode = '';
/** /**
* A geospatial field storing the coordinates of the Address. * A geospatial field storing the coordinates of the Address.
*
* @ORM\Column(type="point")
*/ */
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: 'point')]
private ?Point $point = null; private ?Point $point = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode")
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\PostalCode::class)]
private ?PostalCode $postcode = null; private ?PostalCode $postcode = null;
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $refId = ''; private string $refId = '';
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $source = ''; private string $source = '';
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $street = ''; private string $street = '';
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $streetNumber = ''; private string $streetNumber = '';
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)]
private ?\DateTimeImmutable $updatedAt = null; private ?\DateTimeImmutable $updatedAt = null;
public function getCreatedAt(): ?\DateTimeImmutable public function getCreatedAt(): ?\DateTimeImmutable

View File

@ -16,49 +16,35 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Table(name: 'centers')]
* @ORM\Table(name="centers")
*/
class Center implements HasCenterInterface, \Stringable class Center implements HasCenterInterface, \Stringable
{ {
/** /**
* @var Collection<GroupCenter> * @var Collection<GroupCenter>
*
* @ORM\OneToMany(
* targetEntity="Chill\MainBundle\Entity\GroupCenter",
* mappedBy="center"
* )
*/ */
#[ORM\OneToMany(targetEntity: \Chill\MainBundle\Entity\GroupCenter::class, mappedBy: 'center')]
private Collection $groupCenters; private Collection $groupCenters;
/**
* @ORM\Id
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[Serializer\Groups(['docgen:read'])] #[Serializer\Groups(['docgen:read'])]
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null; private ?int $id = null;
/**
* @ORM\Column(type="string", length=255)
*/
#[Serializer\Groups(['docgen:read'])] #[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
private string $name = ''; private string $name = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
* @ORM\Column(type="boolean")
*/
private bool $isActive = true; private bool $isActive = true;
/** /**
* @var Collection<Regroupment> * @var Collection<Regroupment>
*
* @ORM\ManyToMany(targetEntity=Regroupment::class, mappedBy="centers")
*/ */
#[ORM\ManyToMany(targetEntity: Regroupment::class, mappedBy: 'centers')]
private Collection $regroupments; private Collection $regroupments;
/** /**

View File

@ -14,49 +14,38 @@ namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
/**
* @ORM\Table(name="chill_main_civility")
*
* @ORM\Entity
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_main_civility' => Civility::class])] #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_main_civility' => Civility::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_main_civility')]
class Civility class Civility
{ {
/** /**
* @ORM\Column(type="json")
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/ */
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $abbreviation = []; private array $abbreviation = [];
/**
* @ORM\Column(type="boolean")
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $active = true; private bool $active = true;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/** /**
* @ORM\Column(type="json")
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/ */
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $name = []; private array $name = [];
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, name: 'ordering', nullable: true, options: ['default' => '0.0'])]
* @ORM\Column(type="float", name="ordering", nullable=true, options={"default": 0.0})
*/
private float $order = 0; private float $order = 0;
public function getAbbreviation(): array public function getAbbreviation(): array

View File

@ -18,42 +18,38 @@ use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* Country. * Country.
* *
* @ORM\Entity
* *
* @ORM\Table(name="country")
* *
* @ORM\Cache(usage="READ_ONLY", region="country_cache_region")
* *
* @ORM\HasLifecycleCallbacks
*/ */
#[ORM\Entity]
#[ORM\Cache(usage: 'READ_ONLY', region: 'country_cache_region')]
#[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'country')]
class Country class Country
{ {
/** /**
* @ORM\Column(type="string", length=3)
*
* @Context({"is-translatable": true}, groups={"docgen:read"}) * @Context({"is-translatable": true}, groups={"docgen:read"})
*/ */
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 3)]
private string $countryCode = ''; private string $countryCode = '';
/**
* @ORM\Id
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null; private ?int $id = null;
/** /**
* @var array<string, string> * @var array<string, string>
* *
* @ORM\Column(type="json")
* *
* @Context({"is-translatable": true}, groups={"docgen:read"}) * @Context({"is-translatable": true}, groups={"docgen:read"})
*/ */
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $name = []; private array $name = [];
public function getCountryCode(): string public function getCountryCode(): string

View File

@ -13,42 +13,30 @@ namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Table(name: 'chill_main_cronjob_execution')]
* @ORM\Table(name="chill_main_cronjob_execution")
*/
class CronJobExecution class CronJobExecution
{ {
final public const FAILURE = 100; final public const FAILURE = 100;
final public const SUCCESS = 1; final public const SUCCESS = 1;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true, options: ['default' => null])]
* @ORM\Column(type="datetime_immutable", nullable=true, options={"default": null})
*/
private ?\DateTimeImmutable $lastEnd = null; private ?\DateTimeImmutable $lastEnd = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)]
* @ORM\Column(type="datetime_immutable", nullable=false)
*/
private \DateTimeImmutable $lastStart; private \DateTimeImmutable $lastStart;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true, options: ['default' => null])]
* @ORM\Column(type="integer", nullable=true, options={"default": null})
*/
private ?int $lastStatus = null; private ?int $lastStatus = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => "'{}'::jsonb", 'jsonb' => true])]
* @ORM\Column(type="json", options={"default": "'{}'::jsonb", "jsonb": true})
*/
private array $lastExecutionData = []; private array $lastExecutionData = [];
public function __construct(/** public function __construct(
* @ORM\Column(type="text", nullable=false) #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false)]
* #[ORM\Id]
* @ORM\Id
*/
private string $key private string $key
) { ) {
$this->lastStart = new \DateTimeImmutable('now'); $this->lastStart = new \DateTimeImmutable('now');

View File

@ -15,46 +15,33 @@ use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Table(name: 'chill_main_dashboard_config_item')]
* @ORM\Table(name="chill_main_dashboard_config_item")
*/
class DashboardConfigItem class DashboardConfigItem
{ {
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['dashboardConfigItem:read', 'read'])] #[Serializer\Groups(['dashboardConfigItem:read', 'read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/**
* @ORM\Column(type="string")
*/
#[Serializer\Groups(['dashboardConfigItem:read', 'read'])] #[Serializer\Groups(['dashboardConfigItem:read', 'read'])]
#[Assert\NotNull] #[Assert\NotNull]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
private string $type = ''; private string $type = '';
/**
* @ORM\Column(type="string")
*/
#[Serializer\Groups(['dashboardConfigItem:read', 'read'])] #[Serializer\Groups(['dashboardConfigItem:read', 'read'])]
#[Assert\NotNull] #[Assert\NotNull]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
private string $position = ''; private string $position = '';
/** #[ORM\ManyToOne(targetEntity: User::class)]
* @ORM\ManyToOne(targetEntity=User::class)
*/
private ?User $user = null; private ?User $user = null;
/**
* @ORM\Column(type="json", options={"default": "[]", "jsonb": true})
*/
#[Serializer\Groups(['dashboardConfigItem:read'])] #[Serializer\Groups(['dashboardConfigItem:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '[]', 'jsonb' => true])]
private array $metadata = []; private array $metadata = [];
public function getId(): ?int public function getId(): ?int

View File

@ -14,26 +14,19 @@ namespace Chill\MainBundle\Entity\Embeddable;
use DateTime; use DateTime;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** #[ORM\Embeddable]
* @ORM\Embeddable
*/
class CommentEmbeddable class CommentEmbeddable
{ {
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
* @ORM\Column(type="text", nullable=true)
*/
private ?string $comment = null; private ?string $comment = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)]
* @ORM\Column(type="datetime", nullable=true)
*/
private ?\DateTime $date = null; private ?\DateTime $date = null;
/** /**
* Embeddable does not support associations. * Embeddable does not support associations.
*
* @ORM\Column(type="integer", nullable=true)
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true)]
private ?int $userId = null; private ?int $userId = null;
public function getComment(): ?string public function getComment(): ?string

View File

@ -14,16 +14,13 @@ 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;
/** #[ORM\Embeddable]
* @ORM\Embeddable
*/
class PrivateCommentEmbeddable class PrivateCommentEmbeddable
{ {
/** /**
* @ORM\Column(type="json", nullable=false, options={"default": "{}"})
*
* @var array<int, string> * @var array<int, string>
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: false, options: ['default' => '{}'])]
private array $comments = []; private array $comments = [];
public function getCommentForUser(User $user): string public function getCommentForUser(User $user): string

View File

@ -13,43 +13,28 @@ namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="chill_main_geographical_unit", uniqueConstraints={ #[ORM\Entity(readOnly: true)]
* #[ORM\Table(name: 'chill_main_geographical_unit')]
* @ORM\UniqueConstraint(name="geographical_unit_refid", columns={"layer_id", "unitRefId"}) #[ORM\UniqueConstraint(name: 'geographical_unit_refid', columns: ['layer_id', 'unitRefId'])]
* })
*
* @ORM\Entity(readOnly=true)
*/
class GeographicalUnit class GeographicalUnit
{ {
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
* @ORM\Column(type="text", nullable=true)
*/
private string $geom; private string $geom;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\ManyToOne(targetEntity: GeographicalUnitLayer::class, inversedBy: 'units')]
* @ORM\ManyToOne(targetEntity=GeographicalUnitLayer::class, inversedBy="units")
*/
private ?GeographicalUnitLayer $layer = null; private ?GeographicalUnitLayer $layer = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
private string $unitName; private string $unitName;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
private string $unitRefId; private string $unitRefId;
public function getId(): ?int public function getId(): ?int

View File

@ -16,43 +16,31 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
/**
* @ORM\Table(name="chill_main_geographical_unit_layer", uniqueConstraints={ #[ORM\Entity]
* #[ORM\Table(name: 'chill_main_geographical_unit_layer')]
* @ORM\UniqueConstraint(name="geographical_unit_layer_refid", columns={"refId"}) #[ORM\UniqueConstraint(name: 'geographical_unit_layer_refid', columns: ['refId'])]
* })
*
* @ORM\Entity
*/
class GeographicalUnitLayer class GeographicalUnitLayer
{ {
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/**
* @ORM\Column(type="json", nullable=false, options={"default": "[]"})
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: false, options: ['default' => '[]'])]
private array $name = []; private array $name = [];
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $refId = ''; private string $refId = '';
/** /**
* @var Collection<GeographicalUnit> * @var Collection<GeographicalUnit>
*
* @ORM\OneToMany(targetEntity=GeographicalUnit::class, mappedBy="layer")
*/ */
#[ORM\OneToMany(targetEntity: GeographicalUnit::class, mappedBy: 'layer')]
private Collection $units; private Collection $units;
public function __construct() public function __construct()

View File

@ -15,51 +15,32 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Cache(usage: 'NONSTRICT_READ_WRITE', region: 'acl_cache_region')]
* @ORM\Table(name="group_centers") #[ORM\Table(name: 'group_centers')]
*
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region")
*/
class GroupCenter class GroupCenter
{ {
/**
* @ORM\ManyToOne( #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Center::class, inversedBy: 'groupCenters')]
* targetEntity="Chill\MainBundle\Entity\Center", #[ORM\Cache(usage: 'NONSTRICT_READ_WRITE')]
* inversedBy="groupCenters"
* )
*
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
*/
private ?Center $center = null; private ?Center $center = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(name="id", type="integer") #[ORM\GeneratedValue(strategy: 'AUTO')]
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null; private ?int $id = null;
/**
* @ORM\ManyToOne( #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\PermissionsGroup::class, inversedBy: 'groupCenters')]
* targetEntity="Chill\MainBundle\Entity\PermissionsGroup", #[ORM\Cache(usage: 'NONSTRICT_READ_WRITE')]
* inversedBy="groupCenters")
*
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
*/
private ?PermissionsGroup $permissionsGroup = null; private ?PermissionsGroup $permissionsGroup = null;
/** /**
* @ORM\ManyToMany(
* targetEntity="Chill\MainBundle\Entity\User",
* mappedBy="groupCenters"
* )
*
* @var Collection<User::class> * @var Collection<User::class>
*/ */
#[ORM\ManyToMany(targetEntity: \Chill\MainBundle\Entity\User::class, mappedBy: 'groupCenters')]
private Collection $users; private Collection $users;
/** /**

View File

@ -17,32 +17,30 @@ use Symfony\Component\Serializer\Annotation as Serializer;
/** /**
* Language. * Language.
* *
* @ORM\Entity
* *
* @ORM\Table(name="language")
* *
* @ORM\Cache(usage="READ_ONLY", region="language_cache_region")
* *
* @ORM\HasLifecycleCallbacks
*/ */
#[ORM\Entity]
#[ORM\Cache(usage: 'READ_ONLY', region: 'language_cache_region')]
#[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'language')]
class Language class Language
{ {
/**
* @ORM\Id
*
* @ORM\Column(type="string")
*/
#[Serializer\Groups(['docgen:read'])] #[Serializer\Groups(['docgen:read'])]
#[ORM\Id]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
private ?string $id = null; private ?string $id = null;
/** /**
* @var string array * @var string array
* *
* @ORM\Column(type="json")
* *
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/ */
#[Serializer\Groups(['docgen:read'])] #[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $name = []; private array $name = [];
/** /**

View File

@ -20,102 +20,75 @@ use libphonenumber\PhoneNumber;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap; use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
/**
* @ORM\Table(name="chill_main_location")
*
* @ORM\Entity(repositoryClass=LocationRepository::class)
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['location' => Location::class])] #[DiscriminatorMap(typeProperty: 'type', mapping: ['location' => Location::class])]
#[ORM\Entity(repositoryClass: LocationRepository::class)]
#[ORM\Table(name: 'chill_main_location')]
class Location implements TrackCreationInterface, TrackUpdateInterface class Location implements TrackCreationInterface, TrackUpdateInterface
{ {
/**
* @ORM\Column(type="boolean", nullable=true)
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: true)]
private bool $active = true; private bool $active = true;
/**
* @ORM\ManyToOne(targetEntity=Address::class, cascade={"persist"})
*
* @ORM\JoinColumn(nullable=true)
*/
#[Serializer\Groups(['read', 'write', 'docgen:read'])] #[Serializer\Groups(['read', 'write', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: Address::class, cascade: ['persist'])]
#[ORM\JoinColumn(nullable: true)]
private ?Address $address = null; private ?Address $address = null;
/**
* @ORM\Column(type="boolean")
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $availableForUsers = false; private bool $availableForUsers = false;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)]
private ?\DateTimeImmutable $createdAt = null; private ?\DateTimeImmutable $createdAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\ManyToOne(targetEntity: User::class)]
private ?User $createdBy = null; private ?User $createdBy = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
#[Serializer\Groups(['read', 'write', 'docgen:read'])] #[Serializer\Groups(['read', 'write', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
private ?string $email = null; private ?string $email = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=LocationType::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[Serializer\Groups(['read', 'write', 'docgen:read'])] #[Serializer\Groups(['read', 'write', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: LocationType::class)]
#[ORM\JoinColumn(nullable: false)]
private ?LocationType $locationType = null; private ?LocationType $locationType = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
#[Serializer\Groups(['read', 'write', 'docgen:read'])] #[Serializer\Groups(['read', 'write', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
private ?string $name = null; private ?string $name = null;
/** /**
* @ORM\Column(type="phone_number", nullable=true)
*
* @PhonenumberConstraint(type="any") * @PhonenumberConstraint(type="any")
*/ */
#[Serializer\Groups(['read', 'write', 'docgen:read'])] #[Serializer\Groups(['read', 'write', 'docgen:read'])]
#[ORM\Column(type: 'phone_number', nullable: true)]
private ?PhoneNumber $phonenumber1 = null; private ?PhoneNumber $phonenumber1 = null;
/** /**
* @ORM\Column(type="phone_number", nullable=true)
*
* @PhonenumberConstraint(type="any") * @PhonenumberConstraint(type="any")
*/ */
#[Serializer\Groups(['read', 'write', 'docgen:read'])] #[Serializer\Groups(['read', 'write', 'docgen:read'])]
#[ORM\Column(type: 'phone_number', nullable: true)]
private ?PhoneNumber $phonenumber2 = null; private ?PhoneNumber $phonenumber2 = null;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)]
private ?\DateTimeImmutable $updatedAt = null; private ?\DateTimeImmutable $updatedAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\ManyToOne(targetEntity: User::class)]
private ?User $updatedBy = null; private ?User $updatedBy = null;
public function getActive(): ?bool public function getActive(): ?bool

View File

@ -17,13 +17,11 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap; use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
/**
* @ORM\Table(name="chill_main_location_type")
*
* @ORM\Entity(repositoryClass=LocationTypeRepository::class)
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['location-type' => LocationType::class])] #[DiscriminatorMap(typeProperty: 'type', mapping: ['location-type' => LocationType::class])]
#[UniqueEntity(['defaultFor'])] #[UniqueEntity(['defaultFor'])]
#[ORM\Entity(repositoryClass: LocationTypeRepository::class)]
#[ORM\Table(name: 'chill_main_location_type')]
class LocationType class LocationType
{ {
final public const DEFAULT_FOR_3PARTY = 'thirdparty'; final public const DEFAULT_FOR_3PARTY = 'thirdparty';
@ -36,58 +34,42 @@ class LocationType
final public const STATUS_REQUIRED = 'required'; final public const STATUS_REQUIRED = 'required';
/**
* @ORM\Column(type="boolean", nullable=true)
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: true)]
private bool $active = true; private bool $active = true;
/**
* @ORM\Column(type="string", length=32, options={"default": "optional"})
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 32, options: ['default' => 'optional'])]
private string $addressRequired = self::STATUS_OPTIONAL; private string $addressRequired = self::STATUS_OPTIONAL;
/**
* @ORM\Column(type="boolean")
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $availableForUsers = true; private bool $availableForUsers = true;
/**
* @ORM\Column(type="string", length=32, options={"default": "optional"})
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 32, options: ['default' => 'optional'])]
private string $contactData = self::STATUS_OPTIONAL; private string $contactData = self::STATUS_OPTIONAL;
/**
* @ORM\Column(type="string", nullable=true, length=32, unique=true)
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true, length: 32, unique: true)]
private ?string $defaultFor = null; private ?string $defaultFor = null;
/**
* @ORM\Column(type="boolean")
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $editableByUsers = true; private bool $editableByUsers = true;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/** /**
* @ORM\Column(type="json")
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/ */
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $title = []; private array $title = [];
public function getActive(): ?bool public function getActive(): ?bool

View File

@ -19,55 +19,42 @@ use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Table(name: 'chill_main_news')]
* @ORM\Table(name="chill_main_news")
*/
class NewsItem implements TrackCreationInterface, TrackUpdateInterface class NewsItem implements TrackCreationInterface, TrackUpdateInterface
{ {
use TrackCreationTrait; use TrackCreationTrait;
use TrackUpdateTrait; use TrackUpdateTrait;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/**
* @ORM\Column(type="text")
*/
#[Groups(['read'])] #[Groups(['read'])]
#[Assert\NotBlank] #[Assert\NotBlank]
#[Assert\NotNull] #[Assert\NotNull]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
private string $title = ''; private string $title = '';
/**
* @ORM\Column(type="text")
*/
#[Groups(['read'])] #[Groups(['read'])]
#[Assert\NotBlank] #[Assert\NotBlank]
#[Assert\NotNull] #[Assert\NotNull]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
private string $content = ''; private string $content = '';
/**
* @ORM\Column(type="date_immutable", nullable=false)
*/
#[Assert\NotNull] #[Assert\NotNull]
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: false)]
private ?\DateTimeImmutable $startDate = null; private ?\DateTimeImmutable $startDate = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[Assert\GreaterThanOrEqual(propertyPath: 'startDate')] #[Assert\GreaterThanOrEqual(propertyPath: 'startDate')]
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $endDate = null; private ?\DateTimeImmutable $endDate = null;
public function getTitle(): string public function getTitle(): string

View File

@ -18,24 +18,14 @@ use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\HasLifecycleCallbacks]
* @ORM\Table( #[ORM\Table(name: 'chill_main_notification')]
* name="chill_main_notification", #[ORM\Index(name: 'chill_main_notification_related_entity_idx', columns: ['relatedentityclass', 'relatedentityid'])]
* indexes={
*
* @ORM\Index(name="chill_main_notification_related_entity_idx", columns={"relatedentityclass", "relatedentityid"})
* }
* )
*
* @ORM\HasLifecycleCallbacks
*/
class Notification implements TrackUpdateInterface class Notification implements TrackUpdateInterface
{ {
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false)]
* @ORM\Column(type="text", nullable=false)
*/
private string $accessKey; private string $accessKey;
private array $addedAddresses = []; private array $addedAddresses = [];
@ -43,19 +33,18 @@ class Notification implements TrackUpdateInterface
/** /**
* @var Collection<User> * @var Collection<User>
* *
* @ORM\ManyToMany(targetEntity=User::class)
* *
* @ORM\JoinTable(name="chill_main_notification_addresses_user")
*/ */
#[ORM\ManyToMany(targetEntity: User::class)]
#[ORM\JoinTable(name: 'chill_main_notification_addresses_user')]
private Collection $addressees; private Collection $addressees;
/** /**
* a list of destinee which will receive notifications. * a list of destinee which will receive notifications.
* *
* @var array|string[] * @var array|string[]
*
* @ORM\Column(type="json")
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $addressesEmails = []; private array $addressesEmails = [];
/** /**
@ -70,73 +59,54 @@ class Notification implements TrackUpdateInterface
/** /**
* @var Collection<NotificationComment> * @var Collection<NotificationComment>
* *
* @ORM\OneToMany(targetEntity=NotificationComment::class, mappedBy="notification", orphanRemoval=true)
* *
* @ORM\OrderBy({"createdAt": "ASC"})
*/ */
#[ORM\OneToMany(targetEntity: NotificationComment::class, mappedBy: 'notification', orphanRemoval: true)]
#[ORM\OrderBy(['createdAt' => \Doctrine\Common\Collections\Criteria::ASC])]
private Collection $comments; private Collection $comments;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)]
* @ORM\Column(type="datetime_immutable")
*/
private \DateTimeImmutable $date; private \DateTimeImmutable $date;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
* @ORM\Column(type="text")
*/
private string $message = ''; private string $message = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
* @ORM\Column(type="string", length=255)
*/
private string $relatedEntityClass = ''; private string $relatedEntityClass = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(type="integer")
*/
private int $relatedEntityId; private int $relatedEntityId;
private array $removedAddresses = []; private array $removedAddresses = [];
/**
* @ORM\ManyToOne(targetEntity=User::class) #[ORM\ManyToOne(targetEntity: User::class)]
* #[ORM\JoinColumn(nullable: true)]
* @ORM\JoinColumn(nullable=true)
*/
private ?User $sender = null; private ?User $sender = null;
/**
* @ORM\Column(type="text", options={"default": ""})
*/
#[Assert\NotBlank(message: 'notification.Title must be defined')] #[Assert\NotBlank(message: 'notification.Title must be defined')]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => ''])]
private string $title = ''; private string $title = '';
/** /**
* @var Collection<User> * @var Collection<User>
* *
* @ORM\ManyToMany(targetEntity=User::class)
* *
* @ORM\JoinTable(name="chill_main_notification_addresses_unread")
*/ */
#[ORM\ManyToMany(targetEntity: User::class)]
#[ORM\JoinTable(name: 'chill_main_notification_addresses_unread')]
private Collection $unreadBy; private Collection $unreadBy;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)]
* @ORM\Column(type="datetime_immutable")
*/
private ?\DateTimeImmutable $updatedAt = null; private ?\DateTimeImmutable $updatedAt = null;
/** #[ORM\ManyToOne(targetEntity: User::class)]
* @ORM\ManyToOne(targetEntity=User::class)
*/
private ?User $updatedBy = null; private ?User $updatedBy = null;
public function __construct() public function __construct()
@ -312,9 +282,7 @@ class Notification implements TrackUpdateInterface
return $this->addUnreadBy($user); return $this->addUnreadBy($user);
} }
/** #[ORM\PreFlush]
* @ORM\PreFlush
*/
public function registerUnread() public function registerUnread()
{ {
foreach ($this->addedAddresses as $addressee) { foreach ($this->addedAddresses as $addressee) {

View File

@ -18,47 +18,33 @@ use Doctrine\ORM\Event\PrePersistEventArgs;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\HasLifecycleCallbacks]
* @ORM\Table("chill_main_notification_comment") #[ORM\Table('chill_main_notification_comment')]
*
* @ORM\HasLifecycleCallbacks
*/
class NotificationComment implements TrackCreationInterface, TrackUpdateInterface class NotificationComment implements TrackCreationInterface, TrackUpdateInterface
{ {
/**
* @ORM\Column(type="text")
*/
#[Assert\NotBlank(message: 'notification.Comment content might not be blank')] #[Assert\NotBlank(message: 'notification.Comment content might not be blank')]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
private string $content = ''; private string $content = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)]
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
private ?\DateTimeImmutable $createdAt = null; private ?\DateTimeImmutable $createdAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class) #[ORM\ManyToOne(targetEntity: User::class)]
* #[ORM\JoinColumn(nullable: true)]
* @ORM\JoinColumn(nullable=true)
*/
private ?User $createdBy = null; private ?User $createdBy = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=Notification::class, inversedBy="comments") #[ORM\ManyToOne(targetEntity: Notification::class, inversedBy: 'comments')]
* #[ORM\JoinColumn(nullable: false)]
* @ORM\JoinColumn(nullable=false)
*/
private ?Notification $notification = null; private ?Notification $notification = null;
/** /**
@ -70,16 +56,13 @@ class NotificationComment implements TrackCreationInterface, TrackUpdateInterfac
/** /**
* TODO typo in property (hotfixed). * TODO typo in property (hotfixed).
*
* @ORM\Column(type="datetime_immutable", nullable=true)
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)]
private ?\DateTimeImmutable $updateAt = null; private ?\DateTimeImmutable $updateAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class) #[ORM\ManyToOne(targetEntity: User::class)]
* #[ORM\JoinColumn(nullable: true)]
* @ORM\JoinColumn(nullable=true)
*/
private ?User $updatedBy = null; private ?User $updatedBy = null;
public function getContent(): string public function getContent(): string
@ -117,9 +100,7 @@ class NotificationComment implements TrackCreationInterface, TrackUpdateInterfac
return $this->updatedBy; return $this->updatedBy;
} }
/** #[ORM\PreFlush]
* @ORM\PreFlush
*/
public function onFlushMarkNotificationAsUnread(PreFlushEventArgs $eventArgs): void public function onFlushMarkNotificationAsUnread(PreFlushEventArgs $eventArgs): void
{ {
if ($this->recentlyPersisted) { if ($this->recentlyPersisted) {
@ -135,9 +116,7 @@ class NotificationComment implements TrackCreationInterface, TrackUpdateInterfac
} }
} }
/** #[ORM\PrePersist]
* @ORM\PrePersist
*/
public function onPrePersist(PrePersistEventArgs $eventArgs): void public function onPrePersist(PrePersistEventArgs $eventArgs): void
{ {
$this->recentlyPersisted = true; $this->recentlyPersisted = true;

View File

@ -16,56 +16,40 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Cache(usage: 'NONSTRICT_READ_WRITE', region: 'acl_cache_region')]
* @ORM\Table(name="permission_groups") #[ORM\Table(name: 'permission_groups')]
*
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region")
*/
class PermissionsGroup class PermissionsGroup
{ {
/** /**
* @var string[] * @var string[]
*
* @ORM\Column(type="json")
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $flags = []; private array $flags = [];
/** /**
* @var Collection<GroupCenter> * @var Collection<GroupCenter>
*
* @ORM\OneToMany(
* targetEntity="Chill\MainBundle\Entity\GroupCenter",
* mappedBy="permissionsGroup"
* )
*/ */
#[ORM\OneToMany(targetEntity: \Chill\MainBundle\Entity\GroupCenter::class, mappedBy: 'permissionsGroup')]
private Collection $groupCenters; private Collection $groupCenters;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(name="id", type="integer") #[ORM\GeneratedValue(strategy: 'AUTO')]
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="string", length=255, nullable=false, options={"default": ""})
*/
private string $name = ''; private string $name = '';
/** /**
* @var Collection<RoleScope> * @var Collection<RoleScope>
* *
* @ORM\ManyToMany(
* targetEntity="Chill\MainBundle\Entity\RoleScope",
* inversedBy="permissionsGroups",
* cascade={ "persist" })
* *
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
*/ */
#[ORM\ManyToMany(targetEntity: \Chill\MainBundle\Entity\RoleScope::class, inversedBy: 'permissionsGroups', cascade: ['persist'])]
#[ORM\Cache(usage: 'NONSTRICT_READ_WRITE')]
private Collection $roleScopes; private Collection $roleScopes;
/** /**

View File

@ -22,23 +22,23 @@ use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* PostalCode. * PostalCode.
* *
* @ORM\Entity
* *
* @ORM\Table(
* name="chill_main_postal_code",
* uniqueConstraints={
* *
* @ORM\UniqueConstraint(name="postal_code_import_unicity", columns={"code", "refpostalcodeid", "postalcodesource"},
* options={"where": "refpostalcodeid is not null"})
* },
* indexes={
* *
* @ORM\Index(name="search_name_code", columns={"code", "label"}),
* @ORM\Index(name="search_by_reference_code", columns={"code", "refpostalcodeid"})
* })
* *
* @ORM\HasLifecycleCallbacks *
*
*
*/ */
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'chill_main_postal_code')]
#[ORM\Index(name: 'search_name_code', columns: ['code', 'label'])]
#[ORM\Index(name: 'search_by_reference_code', columns: ['code', 'refpostalcodeid'])]
#[ORM\UniqueConstraint(name: 'postal_code_import_unicity', columns: ['code', 'refpostalcodeid', 'postalcodesource'], options: ['where' => 'refpostalcodeid is not null'])]
#[ORM\UniqueConstraint(name: 'postal_code_import_unicity', columns: ['code', 'refpostalcodeid', 'postalcodesource'], options: ['where' => 'refpostalcodeid is not null'])] // ,
#[ORM\Index(name: 'search_name_code', columns: ['code', 'label'])] // ,
#[ORM\Index(name: 'search_by_reference_code', columns: ['code', 'refpostalcodeid'])]
class PostalCode implements TrackUpdateInterface, TrackCreationInterface class PostalCode implements TrackUpdateInterface, TrackCreationInterface
{ {
use TrackCreationTrait; use TrackCreationTrait;
@ -49,66 +49,46 @@ class PostalCode implements TrackUpdateInterface, TrackCreationInterface
* This is an internal column which is populated by database. * This is an internal column which is populated by database.
* *
* This column will ease the search operations * This column will ease the search operations
*
* @ORM\Column(type="text", options={"default": ""})
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => ''])]
private string $canonical = ''; private string $canonical = '';
/**
* @ORM\Column(type="point", nullable=true)
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: 'point', nullable: true)]
private ?Point $center = null; private ?Point $center = null;
/**
* @ORM\Column(type="string", length=100)
*/
#[Groups(['write', 'read'])] #[Groups(['write', 'read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 100)]
private ?string $code = null; private ?string $code = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Country")
*/
#[Groups(['write', 'read'])] #[Groups(['write', 'read'])]
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Country::class)]
private ?Country $country = null; private ?Country $country = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true, options: ['default' => null])]
* @ORM\Column(type="datetime_immutable", nullable=true, options={"default": null})
*/
private ?\DateTimeImmutable $deletedAt = null; private ?\DateTimeImmutable $deletedAt = null;
/**
* @ORM\Id
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[Groups(['write', 'read'])] #[Groups(['write', 'read'])]
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null; private ?int $id = null;
/**
* @ORM\Column(type="string", length=255, name="label")
*/
#[Groups(['write', 'read'])] #[Groups(['write', 'read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, name: 'label')]
private ?string $name = null; private ?string $name = null;
/**
* @ORM\Column(name="origin", type="integer", nullable=true)
*/
#[Groups(['write', 'read'])] #[Groups(['write', 'read'])]
#[ORM\Column(name: 'origin', type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true)]
private int $origin = 0; private int $origin = 0;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
private ?string $postalCodeSource = null; private ?string $postalCodeSource = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
private ?string $refPostalCodeId = null; private ?string $refPostalCodeId = null;
public function getCenter(): ?Point public function getCenter(): ?Point

View File

@ -15,42 +15,30 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Table(name: 'regroupment')]
* @ORM\Table(name="regroupment")
*/
class Regroupment class Regroupment
{ {
/** /**
* @ORM\ManyToMany(
* targetEntity=Center::class,
* inversedBy="regroupments"
* )
* *
* @ORM\Id
* *
* @var Collection<Center> * @var Collection<Center>
*/ */
#[ORM\ManyToMany(targetEntity: Center::class, inversedBy: 'regroupments')]
#[ORM\Id]
private Collection $centers; private Collection $centers;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
* @ORM\Column(type="boolean")
*/
private bool $isActive = true; private bool $isActive = true;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => ''], nullable: false)]
* @ORM\Column(type="text", options={"default": ""}, nullable=false)
*/
private string $name = ''; private string $name = '';
public function __construct() public function __construct()

View File

@ -15,47 +15,31 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Cache(usage: 'NONSTRICT_READ_WRITE', region: 'acl_cache_region')]
* @ORM\Table(name="role_scopes") #[ORM\Table(name: 'role_scopes')]
*
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region")
*/
class RoleScope class RoleScope
{ {
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(name="id", type="integer") #[ORM\GeneratedValue(strategy: 'AUTO')]
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null; private ?int $id = null;
/** /**
* @var Collection<PermissionsGroup> * @var Collection<PermissionsGroup>
*
* @ORM\ManyToMany(
* targetEntity="Chill\MainBundle\Entity\PermissionsGroup",
* mappedBy="roleScopes")
*/ */
#[ORM\ManyToMany(targetEntity: \Chill\MainBundle\Entity\PermissionsGroup::class, mappedBy: 'roleScopes')]
private Collection $permissionsGroups; private Collection $permissionsGroups;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
* @ORM\Column(type="string", length=255)
*/
private ?string $role = null; private ?string $role = null;
/**
* @ORM\ManyToOne( #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Scope::class, inversedBy: 'roleScopes')]
* targetEntity="Chill\MainBundle\Entity\Scope", #[ORM\JoinColumn(nullable: true, name: 'scope_id')]
* inversedBy="roleScopes") #[ORM\Cache(usage: 'NONSTRICT_READ_WRITE')]
*
* @ORM\JoinColumn(nullable=true, name="scope_id")
*
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
*/
private ?Scope $scope = null; private ?Scope $scope = null;
public function __construct() public function __construct()

View File

@ -20,51 +20,36 @@ use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidInterface; use Ramsey\Uuid\UuidInterface;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Table(name: 'chill_main_saved_export')]
* @ORM\Table(name="chill_main_saved_export")
*/
class SavedExport implements TrackCreationInterface, TrackUpdateInterface class SavedExport implements TrackCreationInterface, TrackUpdateInterface
{ {
use TrackCreationTrait; use TrackCreationTrait;
use TrackUpdateTrait; use TrackUpdateTrait;
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Assert\NotBlank] #[Assert\NotBlank]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $description = ''; private string $description = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
private string $exportAlias; private string $exportAlias;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(name: 'id', type: 'uuid', unique: 'true')]
* @ORM\Column(name="id", type="uuid", unique="true") #[ORM\GeneratedValue(strategy: 'NONE')]
*
* @ORM\GeneratedValue(strategy="NONE")
*/
private UuidInterface $id; private UuidInterface $id;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: false, options: ['default' => '[]'])]
* @ORM\Column(type="json", nullable=false, options={"default": "[]"})
*/
private array $options = []; private array $options = [];
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Assert\NotBlank] #[Assert\NotBlank]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $title = ''; private string $title = '';
/** #[ORM\ManyToOne(targetEntity: User::class)]
* @ORM\ManyToOne(targetEntity=User::class)
*/
private User $user; private User $user;
public function __construct() public function __construct()

View File

@ -18,50 +18,40 @@ use Symfony\Component\Serializer\Annotation\Context;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap; use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity
*
* @ORM\Table(name="scopes")
*
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region")
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['scope' => Scope::class])] #[DiscriminatorMap(typeProperty: 'type', mapping: ['scope' => Scope::class])]
#[ORM\Entity]
#[ORM\Cache(usage: 'NONSTRICT_READ_WRITE', region: 'acl_cache_region')]
#[ORM\Table(name: 'scopes')]
class Scope class Scope
{ {
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: false, options: ['default' => true])]
* @ORM\Column(type="boolean", nullable=false, options={"default": true})
*/
private bool $active = true; private bool $active = true;
/**
* @ORM\Id
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null; private ?int $id = null;
/** /**
* translatable names. * translatable names.
* *
* @ORM\Column(type="json")
* *
* @Context({"is-translatable": true}, groups={"docgen:read"}) * @Context({"is-translatable": true}, groups={"docgen:read"})
*/ */
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $name = []; private array $name = [];
/** /**
* @var Collection<RoleScope> * @var Collection<RoleScope>
* *
* @ORM\OneToMany(
* targetEntity="Chill\MainBundle\Entity\RoleScope",
* mappedBy="scope")
* *
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
*/ */
#[ORM\OneToMany(targetEntity: \Chill\MainBundle\Entity\RoleScope::class, mappedBy: 'scope')]
#[ORM\Cache(usage: 'NONSTRICT_READ_WRITE')]
private Collection $roleScopes; private Collection $roleScopes;
/** /**

View File

@ -28,146 +28,100 @@ use Chill\MainBundle\Validation\Constraint\PhonenumberConstraint;
/** /**
* User. * User.
* *
* @ORM\Entity
* *
* @ORM\Table(name="users")
* *
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region")
*/ */
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['user' => User::class])] #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['user' => User::class])]
#[ORM\Entity]
#[ORM\Cache(usage: 'NONSTRICT_READ_WRITE', region: 'acl_cache_region')]
#[ORM\Table(name: 'users')]
class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInterface class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInterface
{ {
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(name="id", type="integer") #[ORM\GeneratedValue(strategy: 'AUTO')]
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected ?int $id = null; protected ?int $id = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)]
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
private ?\DateTimeImmutable $absenceStart = null; private ?\DateTimeImmutable $absenceStart = null;
/** /**
* Array where SAML attributes's data are stored. * Array where SAML attributes's data are stored.
*
* @ORM\Column(type="json", nullable=false)
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: false)]
private array $attributes = []; private array $attributes = [];
/** #[ORM\ManyToOne(targetEntity: Civility::class)]
* @ORM\ManyToOne(targetEntity=Civility::class)
*/
private ?Civility $civility = null; private ?Civility $civility = null;
/** #[ORM\ManyToOne(targetEntity: Location::class)]
* @ORM\ManyToOne(targetEntity=Location::class)
*/
private ?Location $currentLocation = null; private ?Location $currentLocation = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 150, nullable: true)]
* @ORM\Column(type="string", length=150, nullable=true)
*/
private ?string $email = null; private ?string $email = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 150, nullable: true, unique: true)]
* @ORM\Column(
* type="string",
* length=150,
* nullable=true,
* unique=true)
*/
private ?string $emailCanonical = null; private ?string $emailCanonical = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
* @ORM\Column(type="boolean")
*/
private bool $enabled = true; private bool $enabled = true;
/** /**
* @var Collection<GroupCenter> * @var Collection<GroupCenter>
* *
* @ORM\ManyToMany(
* targetEntity="Chill\MainBundle\Entity\GroupCenter",
* inversedBy="users")
* *
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
*/ */
#[ORM\ManyToMany(targetEntity: \Chill\MainBundle\Entity\GroupCenter::class, inversedBy: 'users')]
#[ORM\Cache(usage: 'NONSTRICT_READ_WRITE')]
private Collection $groupCenters; private Collection $groupCenters;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 200)]
* @ORM\Column(type="string", length=200)
*/
private string $label = ''; private string $label = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] // sf4 check: in yml was false by default !?
* @ORM\Column(type="boolean")
* sf4 check: in yml was false by default !?
*/
private bool $locked = true; private bool $locked = true;
/** #[ORM\ManyToOne(targetEntity: Center::class)]
* @ORM\ManyToOne(targetEntity=Center::class)
*/
private ?Center $mainCenter = null; private ?Center $mainCenter = null;
/** #[ORM\ManyToOne(targetEntity: Location::class)]
* @ORM\ManyToOne(targetEntity=Location::class)
*/
private ?Location $mainLocation = null; private ?Location $mainLocation = null;
/** /**
* @var Collection&Selectable<int, UserScopeHistory> * @var Collection&Selectable<int, UserScopeHistory>
*
* @ORM\OneToMany(targetEntity=UserScopeHistory::class,
* mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true)
*/ */
#[ORM\OneToMany(targetEntity: UserScopeHistory::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)]
private Collection&Selectable $scopeHistories; private Collection&Selectable $scopeHistories;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
* @ORM\Column(type="string", length=255)
*/
private string $password = ''; private string $password = '';
/** /**
* @internal must be set to null if we use bcrypt * @internal must be set to null if we use bcrypt
*
* @ORM\Column(type="string", length=255, nullable=true)
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
private ?string $salt = null; private ?string $salt = null;
/** /**
* @var Collection&Selectable<int, UserJobHistory> * @var Collection&Selectable<int, UserJobHistory>
*
* @ORM\OneToMany(targetEntity=UserJobHistory::class,
* mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true)
*/ */
#[ORM\OneToMany(targetEntity: UserJobHistory::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)]
private Collection&Selectable $jobHistories; private Collection&Selectable $jobHistories;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 80)]
* @ORM\Column(type="string", length=80)
*/
private string $username = ''; private string $username = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 80, unique: true, nullable: true)]
* @ORM\Column(
* type="string",
* length=80,
* unique=true,
* nullable=true)
*/
private ?string $usernameCanonical = null; private ?string $usernameCanonical = null;
/** /**
* The user's mobile phone number. * The user's mobile phone number.
* *
* @ORM\Column(type="phone_number", nullable=true)
* *
* @PhonenumberConstraint() * @PhonenumberConstraint()
*/ */
#[ORM\Column(type: 'phone_number', nullable: true)]
private ?PhoneNumber $phonenumber = null; private ?PhoneNumber $phonenumber = null;
/** /**

View File

@ -16,40 +16,27 @@ use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Entity\UserJob; use Chill\MainBundle\Entity\UserJob;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="chill_main_user_job_history") #[ORM\Entity(repositoryClass: UserJobHistoryRepository::class)]
* #[ORM\Table(name: 'chill_main_user_job_history')]
* @ORM\Entity(repositoryClass=UserJobHistoryRepository::class)
*/
class UserJobHistory class UserJobHistory
{ {
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)]
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
private ?\DateTimeImmutable $endDate = null; private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\ManyToOne(targetEntity: UserJob::class)]
* @ORM\ManyToOne(targetEntity=UserJob::class)
*/
private ?UserJob $job = null; private ?UserJob $job = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)]
* @ORM\Column(type="datetime_immutable")
*/
private \DateTimeImmutable $startDate; private \DateTimeImmutable $startDate;
/** #[ORM\ManyToOne(targetEntity: User::class)]
* @ORM\ManyToOne(targetEntity=User::class)
*/
private User $user; private User $user;
public function getEndDate(): ?\DateTimeImmutable public function getEndDate(): ?\DateTimeImmutable

View File

@ -16,40 +16,27 @@ use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\User;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="chill_main_user_scope_history") #[ORM\Entity(repositoryClass: UserScopeHistoryRepository::class)]
* #[ORM\Table(name: 'chill_main_user_scope_history')]
* @ORM\Entity(repositoryClass=UserScopeHistoryRepository::class)
*/
class UserScopeHistory class UserScopeHistory
{ {
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)]
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
private ?\DateTimeImmutable $endDate = null; private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\ManyToOne(targetEntity: Scope::class)]
* @ORM\ManyToOne(targetEntity=Scope::class)
*/
private ?Scope $scope = null; private ?Scope $scope = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)]
* @ORM\Column(type="datetime_immutable")
*/
private \DateTimeImmutable $startDate; private \DateTimeImmutable $startDate;
/** #[ORM\ManyToOne(targetEntity: User::class)]
* @ORM\ManyToOne(targetEntity=User::class)
*/
private User $user; private User $user;
public function getEndDate(): ?\DateTimeImmutable public function getEndDate(): ?\DateTimeImmutable

View File

@ -14,37 +14,30 @@ namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
/**
* @ORM\Entity
*
* @ORM\Table("chill_main_user_job")
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['user_job' => UserJob::class])] #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['user_job' => UserJob::class])]
#[ORM\Entity]
#[ORM\Table('chill_main_user_job')]
class UserJob class UserJob
{ {
/** #[ORM\Column(name: 'active', type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
* @ORM\Column(name="active", type="boolean")
*/
protected bool $active = true; protected bool $active = true;
/**
* @ORM\Id
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
protected ?int $id = null; protected ?int $id = null;
/** /**
* @var array<string, string> * @var array<string, string>
* *
* @ORM\Column(name="label", type="json")
* *
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/ */
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Column(name: 'label', type: \Doctrine\DBAL\Types\Types::JSON)]
protected array $label = []; protected array $label = [];
public function getId(): ?int public function getId(): ?int

View File

@ -24,13 +24,13 @@ use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
/** /**
* @ORM\Entity
* *
* @ORM\Table("chill_main_workflow_entity")
* *
* @EntityWorkflowCreation(groups={"creation"}) * @EntityWorkflowCreation(groups={"creation"})
*/ */
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['entity_workflow' => EntityWorkflow::class])] #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['entity_workflow' => EntityWorkflow::class])]
#[ORM\Entity]
#[ORM\Table('chill_main_workflow_entity')]
class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
{ {
use TrackCreationTrait; use TrackCreationTrait;
@ -67,39 +67,31 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
public array $futureDestUsers = []; public array $futureDestUsers = [];
/** /**
* @ORM\OneToMany(targetEntity=EntityWorkflowComment::class, mappedBy="entityWorkflow", orphanRemoval=true)
*
* @var Collection<EntityWorkflowComment> * @var Collection<EntityWorkflowComment>
*/ */
#[ORM\OneToMany(targetEntity: EntityWorkflowComment::class, mappedBy: 'entityWorkflow', orphanRemoval: true)]
private Collection $comments; private Collection $comments;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
* @ORM\Column(type="string", length=255)
*/
private string $relatedEntityClass = ''; private string $relatedEntityClass = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(type="integer")
*/
private int $relatedEntityId; private int $relatedEntityId;
/** /**
* @ORM\OneToMany(targetEntity=EntityWorkflowStep::class, mappedBy="entityWorkflow", orphanRemoval=true, cascade={"persist"})
* *
* @ORM\OrderBy({"transitionAt": "ASC", "id": "ASC"})
* *
* @var Collection<EntityWorkflowStep> * @var Collection<EntityWorkflowStep>
*/ */
#[Assert\Valid(traverse: true)] #[Assert\Valid(traverse: true)]
#[ORM\OneToMany(targetEntity: EntityWorkflowStep::class, mappedBy: 'entityWorkflow', orphanRemoval: true, cascade: ['persist'])]
#[ORM\OrderBy(['transitionAt' => \Doctrine\Common\Collections\Criteria::ASC, 'id' => 'ASC'])]
private Collection $steps; private Collection $steps;
/** /**
@ -108,21 +100,21 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
private ?array $stepsChainedCache = null; private ?array $stepsChainedCache = null;
/** /**
* @ORM\ManyToMany(targetEntity=User::class)
* *
* @ORM\JoinTable(name="chill_main_workflow_entity_subscriber_to_final")
* *
* @var Collection<User> * @var Collection<User>
*/ */
#[ORM\ManyToMany(targetEntity: User::class)]
#[ORM\JoinTable(name: 'chill_main_workflow_entity_subscriber_to_final')]
private Collection $subscriberToFinal; private Collection $subscriberToFinal;
/** /**
* @ORM\ManyToMany(targetEntity=User::class)
* *
* @ORM\JoinTable(name="chill_main_workflow_entity_subscriber_to_step")
* *
* @var Collection<User> * @var Collection<User>
*/ */
#[ORM\ManyToMany(targetEntity: User::class)]
#[ORM\JoinTable(name: 'chill_main_workflow_entity_subscriber_to_step')]
private Collection $subscriberToStep; private Collection $subscriberToStep;
/** /**
@ -130,9 +122,7 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
*/ */
private ?EntityWorkflowStep $transitionningStep = null; private ?EntityWorkflowStep $transitionningStep = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
* @ORM\Column(type="text")
*/
private string $workflowName; private string $workflowName;
public function __construct() public function __construct()

View File

@ -17,34 +17,25 @@ use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait; use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Table('chill_main_workflow_entity_comment')]
* @ORM\Table("chill_main_workflow_entity_comment")
*/
class EntityWorkflowComment implements TrackCreationInterface, TrackUpdateInterface class EntityWorkflowComment implements TrackCreationInterface, TrackUpdateInterface
{ {
use TrackCreationTrait; use TrackCreationTrait;
use TrackUpdateTrait; use TrackUpdateTrait;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => ''])]
* @ORM\Column(type="text", options={"default": ""})
*/
private string $comment = ''; private string $comment = '';
/** #[ORM\ManyToOne(targetEntity: EntityWorkflow::class, inversedBy: 'comments')]
* @ORM\ManyToOne(targetEntity=EntityWorkflow::class, inversedBy="comments")
*/
private ?EntityWorkflow $entityWorkflow = null; private ?EntityWorkflow $entityWorkflow = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
public function getComment(): string public function getComment(): string

View File

@ -18,82 +18,63 @@ use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Table('chill_main_workflow_entity_step')]
* @ORM\Table("chill_main_workflow_entity_step")
*/
class EntityWorkflowStep class EntityWorkflowStep
{ {
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false)]
* @ORM\Column(type="text", nullable=false)
*/
private string $accessKey; private string $accessKey;
/** /**
* @var Collection<User> * @var Collection<User>
* *
* @ORM\ManyToMany(targetEntity=User::class)
* *
* @ORM\JoinTable(name="chill_main_workflow_entity_step_cc_user")
*/ */
#[ORM\ManyToMany(targetEntity: User::class)]
#[ORM\JoinTable(name: 'chill_main_workflow_entity_step_cc_user')]
private Collection $ccUser; private Collection $ccUser;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => ''])]
* @ORM\Column(type="text", options={"default": ""})
*/
private string $comment = ''; private string $comment = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
* @ORM\Column(type="text")
*/
private ?string $currentStep = ''; private ?string $currentStep = '';
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
* @ORM\Column(type="json")
*/
private array $destEmail = []; private array $destEmail = [];
/** /**
* @var Collection<User> * @var Collection<User>
* *
* @ORM\ManyToMany(targetEntity=User::class)
* *
* @ORM\JoinTable(name="chill_main_workflow_entity_step_user")
*/ */
#[ORM\ManyToMany(targetEntity: User::class)]
#[ORM\JoinTable(name: 'chill_main_workflow_entity_step_user')]
private Collection $destUser; private Collection $destUser;
/** /**
* @var Collection<User> * @var Collection<User>
* *
* @ORM\ManyToMany(targetEntity=User::class)
* *
* @ORM\JoinTable(name="chill_main_workflow_entity_step_user_by_accesskey")
*/ */
#[ORM\ManyToMany(targetEntity: User::class)]
#[ORM\JoinTable(name: 'chill_main_workflow_entity_step_user_by_accesskey')]
private Collection $destUserByAccessKey; private Collection $destUserByAccessKey;
/** #[ORM\ManyToOne(targetEntity: EntityWorkflow::class, inversedBy: 'steps')]
* @ORM\ManyToOne(targetEntity=EntityWorkflow::class, inversedBy="steps")
*/
private ?EntityWorkflow $entityWorkflow = null; private ?EntityWorkflow $entityWorkflow = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
* @ORM\Column(type="boolean", options={"default": false})
*/
private bool $freezeAfter = false; private bool $freezeAfter = false;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
* @ORM\Column(type="boolean", options={"default": false})
*/
private bool $isFinal = false; private bool $isFinal = false;
/** /**
@ -106,26 +87,18 @@ class EntityWorkflowStep
*/ */
private ?EntityWorkflowStep $previous = null; private ?EntityWorkflowStep $previous = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true, options: ['default' => null])]
* @ORM\Column(type="text", nullable=true, options={"default": null})
*/
private ?string $transitionAfter = null; private ?string $transitionAfter = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true, options: ['default' => null])]
* @ORM\Column(type="datetime_immutable", nullable=true, options={"default": null})
*/
private ?\DateTimeImmutable $transitionAt = null; private ?\DateTimeImmutable $transitionAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class) #[ORM\ManyToOne(targetEntity: User::class)]
* #[ORM\JoinColumn(nullable: true)]
* @ORM\JoinColumn(nullable=true)
*/
private ?User $transitionBy = null; private ?User $transitionBy = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
* @ORM\Column(type="text", nullable=true)
*/
private ?string $transitionByEmail = null; private ?string $transitionByEmail = null;
public function __construct() public function __construct()

View File

@ -102,7 +102,7 @@ class SortExportElementTest extends KernelTestCase
private function makeTranslator(): TranslatorInterface private function makeTranslator(): TranslatorInterface
{ {
return new class () implements TranslatorInterface { return new class () implements TranslatorInterface {
public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null) public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null)
{ {
return $id; return $id;
} }

View File

@ -54,9 +54,7 @@ use UnexpectedValueException;
/** /**
* AccompanyingPeriod Class. * AccompanyingPeriod Class.
* *
* @ORM\Entity
* *
* @ORM\Table(name="chill_person_accompanying_period")
* *
* @AccompanyingPeriodValidity(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED}) * @AccompanyingPeriodValidity(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED})
* *
@ -66,6 +64,8 @@ use UnexpectedValueException;
*/ */
#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period' => AccompanyingPeriod::class])] #[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period' => AccompanyingPeriod::class])]
#[Assert\GroupSequenceProvider] #[Assert\GroupSequenceProvider]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_accompanying_period')]
class AccompanyingPeriod implements class AccompanyingPeriod implements
GroupSequenceProviderInterface, GroupSequenceProviderInterface,
HasCentersInterface, HasCentersInterface,
@ -131,285 +131,196 @@ class AccompanyingPeriod implements
*/ */
final public const STEP_DRAFT = 'DRAFT'; final public const STEP_DRAFT = 'DRAFT';
/** #[ORM\ManyToOne(targetEntity: Address::class)]
* @ORM\ManyToOne(
* targetEntity=Address::class
* )
*/
private ?Address $addressLocation = null; private ?Address $addressLocation = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location")
*/
#[Groups(['read', 'write'])] #[Groups(['read', 'write'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])] #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])]
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Location::class)]
private ?Location $administrativeLocation = null; private ?Location $administrativeLocation = null;
/** /**
* @var Collection&Selectable<int, Calendar> * @var Collection&Selectable<int, Calendar>
*
* @ORM\OneToMany(targetEntity="Chill\CalendarBundle\Entity\Calendar", mappedBy="accompanyingPeriod")
*/ */
#[ORM\OneToMany(targetEntity: \Chill\CalendarBundle\Entity\Calendar::class, mappedBy: 'accompanyingPeriod')]
private Collection&Selectable $calendars; private Collection&Selectable $calendars;
/**
* @ORM\Column(type="date", nullable=true)
*/
#[Groups(['read', 'write', 'docgen:read'])] #[Groups(['read', 'write', 'docgen:read'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CLOSED])] #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CLOSED])]
#[Assert\GreaterThanOrEqual(propertyPath: 'openingDate', groups: [AccompanyingPeriod::STEP_CLOSED], message: 'The closing date must be later than the date of creation')] #[Assert\GreaterThanOrEqual(propertyPath: 'openingDate', groups: [AccompanyingPeriod::STEP_CLOSED], message: 'The closing date must be later than the date of creation')]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)]
private ?\DateTime $closingDate = null; private ?\DateTime $closingDate = null;
/**
* @ORM\ManyToOne(
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive")
*
* @ORM\JoinColumn(nullable=true)
*/
#[Groups(['read', 'write'])] #[Groups(['read', 'write'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CLOSED])] #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CLOSED])]
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive::class)]
#[ORM\JoinColumn(nullable: true)]
private ?ClosingMotive $closingMotive = null; private ?ClosingMotive $closingMotive = null;
/** /**
* @ORM\OneToMany(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\Comment",
* mappedBy="accompanyingPeriod",
* cascade={"persist", "remove"},
* orphanRemoval=true
* )
* *
* @ORM\OrderBy({"createdAt": "DESC", "id": "DESC"})
* *
* @var Collection<Comment> * @var Collection<Comment>
*/ */
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_DRAFT])] #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_DRAFT])]
#[ORM\OneToMany(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod\Comment::class, mappedBy: 'accompanyingPeriod', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['createdAt' => \Doctrine\Common\Collections\Criteria::DESC, 'id' => 'DESC'])]
private Collection $comments; private Collection $comments;
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
#[Groups(['read', 'write', 'docgen:read'])] #[Groups(['read', 'write', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
private bool $confidential = false; private bool $confidential = false;
/**
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
*/
#[Groups(['docgen:read'])] #[Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeInterface $createdAt = null; private ?\DateTimeInterface $createdAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=true)
*/
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: true)]
private ?User $createdBy = null; private ?User $createdBy = null;
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
#[Groups(['read', 'write', 'docgen:read'])] #[Groups(['read', 'write', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
private bool $emergency = false; private bool $emergency = false;
/**
* @ORM\Id
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null; private ?int $id = null;
/**
* @ORM\Column(type="string", nullable=true)
*/
#[Groups(['read'])] #[Groups(['read'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])] #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)]
private ?string $intensity = self::INTENSITY_OCCASIONAL; private ?string $intensity = self::INTENSITY_OCCASIONAL;
/**
* @ORM\ManyToOne(
* targetEntity=UserJob::class
* )
*/
#[Groups(['read', 'write'])] #[Groups(['read', 'write'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])] #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])]
#[ORM\ManyToOne(targetEntity: UserJob::class)]
private ?UserJob $job = null; private ?UserJob $job = null;
/** /**
* @var Collection<AccompanyingPeriodLocationHistory> * @var Collection<AccompanyingPeriodLocationHistory>
*
* @ORM\OneToMany(targetEntity=AccompanyingPeriodLocationHistory::class,
* mappedBy="period", cascade={"persist", "remove"}, orphanRemoval=true)
*/ */
#[ORM\OneToMany(targetEntity: AccompanyingPeriodLocationHistory::class, mappedBy: 'period', cascade: ['persist', 'remove'], orphanRemoval: true)]
private Collection $locationHistories; private Collection $locationHistories;
/**
* @ORM\Column(type="date")
*/
#[Groups(['read', 'write', 'docgen:read'])] #[Groups(['read', 'write', 'docgen:read'])]
#[Assert\LessThan(value: 'tomorrow', groups: [AccompanyingPeriod::STEP_CONFIRMED])] #[Assert\LessThan(value: 'tomorrow', groups: [AccompanyingPeriod::STEP_CONFIRMED])]
#[Assert\LessThanOrEqual(propertyPath: 'closingDate', groups: [AccompanyingPeriod::STEP_CONFIRMED])] #[Assert\LessThanOrEqual(propertyPath: 'closingDate', groups: [AccompanyingPeriod::STEP_CONFIRMED])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE)]
private ?\DateTime $openingDate = null; private ?\DateTime $openingDate = null;
/**
* @ORM\ManyToOne(targetEntity=Origin::class)
*
* @ORM\JoinColumn(nullable=true)
*/
#[Groups(['read', 'write'])] #[Groups(['read', 'write'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])] #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])]
#[ORM\ManyToOne(targetEntity: Origin::class)]
#[ORM\JoinColumn(nullable: true)]
private ?Origin $origin = null; private ?Origin $origin = null;
/** /**
* @ORM\OneToMany(targetEntity=AccompanyingPeriodParticipation::class,
* mappedBy="accompanyingPeriod", orphanRemoval=true,
* cascade={"persist", "refresh", "remove", "merge", "detach"})
* *
* @ParticipationOverlap(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED}) * @ParticipationOverlap(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED})
*
* @var Collection<AccompanyingPeriodParticipation> * @var Collection<AccompanyingPeriodParticipation>
*/ */
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\OneToMany(targetEntity: AccompanyingPeriodParticipation::class, mappedBy: 'accompanyingPeriod', orphanRemoval: true, cascade: ['persist', 'refresh', 'remove', 'merge', 'detach'])]
private Collection $participations; private Collection $participations;
/** #[ORM\ManyToOne(targetEntity: Person::class, inversedBy: 'periodLocatedOn')]
* @ORM\ManyToOne(
* targetEntity=Person::class,
* inversedBy="periodLocatedOn"
* )
*/
private ?Person $personLocation = null; private ?Person $personLocation = null;
/**
* @ORM\ManyToOne(
* targetEntity=Comment::class,
* cascade={"persist"},
* )
*
* @ORM\JoinColumn(onDelete="SET NULL")
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\ManyToOne(targetEntity: Comment::class, cascade: ['persist'])]
#[ORM\JoinColumn(onDelete: 'SET NULL')]
private ?Comment $pinnedComment = null; private ?Comment $pinnedComment = null;
private bool $preventUserIsChangedNotification = false; private bool $preventUserIsChangedNotification = false;
/**
* @ORM\Column(type="text")
*/
#[Groups(['read', 'write'])] #[Groups(['read', 'write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
private string $remark = ''; private string $remark = '';
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
#[Groups(['read', 'write', 'docgen:read'])] #[Groups(['read', 'write', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
private bool $requestorAnonymous = false; private bool $requestorAnonymous = false;
/**
* @ORM\ManyToOne(targetEntity=Person::class, inversedBy="accompanyingPeriodRequested") #[ORM\ManyToOne(targetEntity: Person::class, inversedBy: 'accompanyingPeriodRequested')]
* #[ORM\JoinColumn(nullable: true)]
* @ORM\JoinColumn(nullable=true)
*/
private ?Person $requestorPerson = null; private ?Person $requestorPerson = null;
/**
* @ORM\ManyToOne(targetEntity=ThirdParty::class) #[ORM\ManyToOne(targetEntity: ThirdParty::class)]
* #[ORM\JoinColumn(nullable: true)]
* @ORM\JoinColumn(nullable=true)
*/
private ?ThirdParty $requestorThirdParty = null; private ?ThirdParty $requestorThirdParty = null;
/** /**
* @var Collection<resource> * @var Collection<resource>
* *
* @ORM\OneToMany(
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\Resource",
* mappedBy="accompanyingPeriod",
* cascade={"persist", "remove"},
* orphanRemoval=true
* )
* *
* @ResourceDuplicateCheck(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED, "Default", "default"}) * @ResourceDuplicateCheck(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED, "Default", "default"})
*/ */
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\OneToMany(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod\Resource::class, mappedBy: 'accompanyingPeriod', cascade: ['persist', 'remove'], orphanRemoval: true)]
private Collection $resources; private Collection $resources;
/** /**
* @var Collection<Scope> * @var Collection<Scope>
* *
* @ORM\ManyToMany(
* targetEntity=Scope::class,
* cascade={}
* )
* *
* @ORM\JoinTable(
* name="accompanying_periods_scopes",
* joinColumns={@ORM\JoinColumn(name="accompanying_period_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="scope_id", referencedColumnName="id")}
* )
*/ */
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must be associated to at least one scope')] #[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must be associated to at least one scope')]
#[ORM\ManyToMany(targetEntity: Scope::class, cascade: [])]
#[ORM\JoinTable(name: 'accompanying_periods_scopes', joinColumns: [new ORM\JoinColumn(name: 'accompanying_period_id', referencedColumnName: 'id')], inverseJoinColumns: [new ORM\JoinColumn(name: 'scope_id', referencedColumnName: 'id')])]
private Collection $scopes; private Collection $scopes;
/** /**
* @var Collection<SocialIssue> * @var Collection<SocialIssue>
* *
* @ORM\ManyToMany(
* targetEntity=SocialIssue::class
* )
* *
* @ORM\JoinTable(
* name="chill_person_accompanying_period_social_issues"
* )
*/ */
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must contains at least one social issue')] #[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must contains at least one social issue')]
#[ORM\ManyToMany(targetEntity: SocialIssue::class)]
#[ORM\JoinTable(name: 'chill_person_accompanying_period_social_issues')]
private Collection $socialIssues; private Collection $socialIssues;
/** /**
* @ORM\Column(type="string", length=32, nullable=true)
*
* @var AccompanyingPeriod::STEP_* * @var AccompanyingPeriod::STEP_*
*/ */
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 32, nullable: true)]
private ?string $step = self::STEP_DRAFT; private ?string $step = self::STEP_DRAFT;
/** /**
* @var Collection<AccompanyingPeriodStepHistory> * @var Collection<AccompanyingPeriodStepHistory>
*
* @ORM\OneToMany(targetEntity=AccompanyingPeriodStepHistory::class,
* mappedBy="period", cascade={"persist", "remove"}, orphanRemoval=true)
*/ */
#[ORM\OneToMany(targetEntity: AccompanyingPeriodStepHistory::class, mappedBy: 'period', cascade: ['persist', 'remove'], orphanRemoval: true)]
private Collection $stepHistories; private Collection $stepHistories;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true, options: ['default' => null])]
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
*/
private ?\DateTimeInterface $updatedAt = null; private ?\DateTimeInterface $updatedAt = null;
/** #[ORM\ManyToOne(targetEntity: User::class)]
* @ORM\ManyToOne(
* targetEntity=User::class
* )
*/
private ?User $updatedBy = null; private ?User $updatedBy = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=true)
*/
#[Groups(['read', 'write', 'docgen:read'])] #[Groups(['read', 'write', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: true)]
private ?User $user = null; private ?User $user = null;
/** /**
* @ORM\OneToMany(targetEntity=UserHistory::class, mappedBy="accompanyingPeriod", orphanRemoval=true,
* cascade={"persist", "remove"})
*
* @var Collection<UserHistory> * @var Collection<UserHistory>
*/ */
#[ORM\OneToMany(targetEntity: UserHistory::class, mappedBy: 'accompanyingPeriod', orphanRemoval: true, cascade: ['persist', 'remove'])]
private Collection $userHistories; private Collection $userHistories;
private bool $userIsChanged = false; private bool $userIsChanged = false;
@ -423,13 +334,9 @@ class AccompanyingPeriod implements
/** /**
* @var Collection<AccompanyingPeriodWork> * @var Collection<AccompanyingPeriodWork>
*
* @ORM\OneToMany(
* targetEntity=AccompanyingPeriodWork::class,
* mappedBy="accompanyingPeriod"
* )
*/ */
#[Assert\Valid(traverse: true)] #[Assert\Valid(traverse: true)]
#[ORM\OneToMany(targetEntity: AccompanyingPeriodWork::class, mappedBy: 'accompanyingPeriod')]
private Collection $works; private Collection $works;
/** /**

View File

@ -25,64 +25,59 @@ use Doctrine\ORM\Mapping as ORM;
* *
* - get the user involved with an accompanying period * - get the user involved with an accompanying period
* *
* @ORM\Entity()
* *
* @ORM\Table(name="view_chill_person_accompanying_period_info")
*/ */
#[ORM\Entity]
#[ORM\Table(name: 'view_chill_person_accompanying_period_info')]
class AccompanyingPeriodInfo class AccompanyingPeriodInfo
{ {
public function __construct( public function __construct(
/** /**
* @var AccompanyingPeriod * @var AccompanyingPeriod
*
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
*/ */
#[ORM\ManyToOne(targetEntity: AccompanyingPeriod::class)]
public readonly AccompanyingPeriod $accompanyingPeriod, public readonly AccompanyingPeriod $accompanyingPeriod,
/** /**
* @var string * @var string
* *
* @ORM\Column(type="text")
* *
* @ORM\Id
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
#[ORM\Id]
public readonly string $relatedEntity, public readonly string $relatedEntity,
/** /**
* @var int * @var int
* *
* @ORM\Column(type="integer")
* *
* @ORM\Id
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\Id]
public readonly int $relatedEntityId, public readonly int $relatedEntityId,
/** /**
* @var User * @var User
*
* @ORM\ManyToOne(targetEntity=User::class)
*/ */
#[ORM\ManyToOne(targetEntity: User::class)]
public readonly ?User $user, public readonly ?User $user,
/** /**
* @var \DateTimeImmutable * @var \DateTimeImmutable
*
* @ORM\Column(type="datetime_immutable")
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)]
public readonly \DateTimeImmutable $infoDate, public readonly \DateTimeImmutable $infoDate,
/** /**
* @var array * @var array
*
* @ORM\Column(type="json")
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
public readonly array $metadata, public readonly array $metadata,
/** /**
* @var string * @var string
*
* @ORM\Column(type="text")
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
public readonly string $discriminator, public readonly string $discriminator,
) {} ) {}
} }

View File

@ -18,47 +18,32 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\Person;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Table('chill_person_accompanying_period_location_history')]
* @ORM\Table("chill_person_accompanying_period_location_history")
*/
class AccompanyingPeriodLocationHistory implements TrackCreationInterface class AccompanyingPeriodLocationHistory implements TrackCreationInterface
{ {
use TrackCreationTrait; use TrackCreationTrait;
/** #[ORM\ManyToOne(targetEntity: Address::class, cascade: ['persist'])]
* @ORM\ManyToOne(targetEntity=Address::class, cascade={"persist"})
*/
private ?Address $addressLocation = null; private ?Address $addressLocation = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
private ?\DateTimeImmutable $endDate = null; private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\ManyToOne(targetEntity: AccompanyingPeriod::class)]
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
*/
private AccompanyingPeriod $period; private AccompanyingPeriod $period;
/** #[ORM\ManyToOne(targetEntity: Person::class)]
* @ORM\ManyToOne(targetEntity=Person::class)
*/
private ?Person $personLocation = null; private ?Person $personLocation = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE)]
* @ORM\Column(type="date_immutable")
*/
private ?\DateTimeImmutable $startDate = null; private ?\DateTimeImmutable $startDate = null;
public function getAddressLocation(): ?Address public function getAddressLocation(): ?Address

View File

@ -19,51 +19,36 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\Person;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Table('chill_person_accompanying_period_step_history')]
* @ORM\Table("chill_person_accompanying_period_step_history")
*/
class AccompanyingPeriodStepHistory implements TrackCreationInterface, TrackUpdateInterface class AccompanyingPeriodStepHistory implements TrackCreationInterface, TrackUpdateInterface
{ {
use TrackCreationTrait; use TrackCreationTrait;
use TrackUpdateTrait; use TrackUpdateTrait;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
private ?\DateTimeImmutable $endDate = null; private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\ManyToOne(targetEntity: AccompanyingPeriod::class)]
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
*/
private AccompanyingPeriod $period; private AccompanyingPeriod $period;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE)]
* @ORM\Column(type="date_immutable")
*/
private ?\DateTimeImmutable $startDate = null; private ?\DateTimeImmutable $startDate = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false)]
* @ORM\Column(type="text", nullable=false)
*/
private string $step; private string $step;
/**
* @ORM\ManyToOne(targetEntity=ClosingMotive::class) #[ORM\ManyToOne(targetEntity: ClosingMotive::class)]
* #[ORM\JoinColumn(nullable: true)]
* @ORM\JoinColumn(nullable=true)
*/
private ?ClosingMotive $closingMotive = null; private ?ClosingMotive $closingMotive = null;
public function getEndDate(): ?\DateTimeImmutable public function getEndDate(): ?\DateTimeImmutable

View File

@ -29,186 +29,141 @@ use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
*
* @ORM\Table(name="chill_person_accompanying_period_work")
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work' => AccompanyingPeriodWork::class])] #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work' => AccompanyingPeriodWork::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_accompanying_period_work')]
class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, TrackCreationInterface, TrackUpdateInterface class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, TrackCreationInterface, TrackUpdateInterface
{ {
/** /**
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
*
* @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"}) * @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"})
*/ */
#[Serializer\Groups(['read', 'read:accompanyingPeriodWork:light'])] #[Serializer\Groups(['read', 'read:accompanyingPeriodWork:light'])]
#[ORM\ManyToOne(targetEntity: AccompanyingPeriod::class)]
private ?AccompanyingPeriod $accompanyingPeriod = null; private ?AccompanyingPeriod $accompanyingPeriod = null;
/** /**
* @ORM\OneToMany(
* targetEntity=AccompanyingPeriodWorkEvaluation::class,
* mappedBy="accompanyingPeriodWork",
* cascade={"remove", "persist"},
* orphanRemoval=true
* )
* *
* @ORM\OrderBy({"startDate": "DESC", "id": "DESC"})
* *
* @var Collection<AccompanyingPeriodWorkEvaluation> * @var Collection<AccompanyingPeriodWorkEvaluation>
* *
* @internal /!\ the serialization for write evaluations is handled in `AccompanyingPeriodWorkDenormalizer` * @internal /!\ the serialization for write evaluations is handled in `AccompanyingPeriodWorkDenormalizer`
*/ */
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\OneToMany(targetEntity: AccompanyingPeriodWorkEvaluation::class, mappedBy: 'accompanyingPeriodWork', cascade: ['remove', 'persist'], orphanRemoval: true)]
#[ORM\OrderBy(['startDate' => \Doctrine\Common\Collections\Criteria::DESC, 'id' => 'DESC'])]
private Collection $accompanyingPeriodWorkEvaluations; private Collection $accompanyingPeriodWorkEvaluations;
/**
* @ORM\Column(type="datetime_immutable")
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])] #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)]
private ?\DateTimeImmutable $createdAt = null; private ?\DateTimeImmutable $createdAt = null;
/**
* @ORM\Column(type="boolean")
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])] #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $createdAutomatically = false; private bool $createdAutomatically = false;
/**
* @ORM\Column(type="text")
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])] #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
private string $createdAutomaticallyReason = ''; private string $createdAutomaticallyReason = '';
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])] #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: false)]
private ?User $createdBy = null; private ?User $createdBy = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": 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])]
private ?\DateTimeImmutable $endDate = null; private ?\DateTimeImmutable $endDate = null;
/** /**
* @var Collection<AccompanyingPeriodWorkGoal> * @var Collection<AccompanyingPeriodWorkGoal>
*
* @ORM\OneToMany(
* targetEntity=AccompanyingPeriodWorkGoal::class,
* mappedBy="accompanyingPeriodWork",
* cascade={"persist"},
* orphanRemoval=true
* )
*/ */
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])] #[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
#[ORM\OneToMany(targetEntity: AccompanyingPeriodWorkGoal::class, mappedBy: 'accompanyingPeriodWork', cascade: ['persist'], orphanRemoval: true)]
private Collection $goals; private Collection $goals;
/**
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])] #[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
#[ORM\ManyToOne(targetEntity: ThirdParty::class)]
private ?ThirdParty $handlingThierParty = null; private ?ThirdParty $handlingThierParty = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'read:evaluation:include-work'])] #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'read:evaluation:include-work'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/**
* @ORM\Column(type="text")
*/
#[Serializer\Groups(['read', 'accompanying_period_work:edit', 'docgen:read'])] #[Serializer\Groups(['read', 'accompanying_period_work:edit', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
private string $note = ''; private string $note = '';
/** /**
* @var Collection<Person> * @var Collection<Person>
* *
* @ORM\ManyToMany(targetEntity=Person::class)
* *
* @ORM\JoinTable(name="chill_person_accompanying_period_work_person")
*/ */
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'accompanying_period_work:edit', 'accompanying_period_work:create'])] #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'accompanying_period_work:edit', 'accompanying_period_work:create'])]
#[ORM\ManyToMany(targetEntity: Person::class)]
#[ORM\JoinTable(name: 'chill_person_accompanying_period_work_person')]
private Collection $persons; private Collection $persons;
/**
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_")
*/
#[Serializer\Groups(['read', 'accompanying_period_work:edit'])] #[Serializer\Groups(['read', 'accompanying_period_work:edit'])]
#[ORM\Embedded(class: \Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable::class, columnPrefix: 'privateComment_')]
private PrivateCommentEmbeddable $privateComment; private PrivateCommentEmbeddable $privateComment;
/** /**
* @var Collection<int, AccompanyingPeriodWorkReferrerHistory> * @var Collection<int, AccompanyingPeriodWorkReferrerHistory>
*
* @ORM\OneToMany(targetEntity=AccompanyingPeriodWorkReferrerHistory::class, cascade={"persist", "remove"}, mappedBy="accompanyingPeriodWork", orphanRemoval=true)
*/ */
#[ORM\OneToMany(targetEntity: AccompanyingPeriodWorkReferrerHistory::class, cascade: ['persist', 'remove'], mappedBy: 'accompanyingPeriodWork', orphanRemoval: true)]
private Collection $referrersHistory; private Collection $referrersHistory;
/** /**
* @var Collection<Result> * @var Collection<Result>
* *
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorks")
* *
* @ORM\JoinTable(name="chill_person_accompanying_period_work_result")
*/ */
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])] #[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
#[ORM\ManyToMany(targetEntity: Result::class, inversedBy: 'accompanyingPeriodWorks')]
#[ORM\JoinTable(name: 'chill_person_accompanying_period_work_result')]
private Collection $results; private Collection $results;
/** /**
* @ORM\ManyToOne(targetEntity=SocialAction::class)
*
* @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"}) * @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"})
*/ */
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'accompanying_period_work:create'])] #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'accompanying_period_work:create'])]
#[ORM\ManyToOne(targetEntity: SocialAction::class)]
private ?SocialAction $socialAction = null; private ?SocialAction $socialAction = null;
/**
* @ORM\Column(type="date_immutable")
*/
#[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'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE)]
private ?\DateTimeImmutable $startDate = null; private ?\DateTimeImmutable $startDate = null;
/** /**
* @var Collection<ThirdParty> * @var Collection<ThirdParty>
* *
* @ORM\ManyToMany(targetEntity=ThirdParty::class)
* *
* @ORM\JoinTable(name="chill_person_accompanying_period_work_third_party")
*
* In schema : intervenants
*/ */
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])] #[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
#[ORM\ManyToMany(targetEntity: ThirdParty::class)]
#[ORM\JoinTable(name: 'chill_person_accompanying_period_work_third_party')] // In schema : intervenants
private Collection $thirdParties; private Collection $thirdParties;
/**
* @ORM\Column(type="datetime_immutable")
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)]
private ?\DateTimeImmutable $updatedAt = null; private ?\DateTimeImmutable $updatedAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: false)]
private ?User $updatedBy = null; private ?User $updatedBy = null;
/**
* @ORM\Column(type="integer", nullable=false, options={"default": 1})
*
* @ORM\Version
*/
#[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\Version]
private int $version = 1; private int $version = 1;
public function __construct() public function __construct()

View File

@ -21,43 +21,29 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
/**
* @ORM\Entity
*
* @ORM\Table("chill_person_accompanying_period_work_evaluation")
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work_evaluation' => AccompanyingPeriodWorkEvaluation::class])] #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work_evaluation' => AccompanyingPeriodWorkEvaluation::class])]
#[ORM\Entity]
#[ORM\Table('chill_person_accompanying_period_work_evaluation')]
class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackUpdateInterface class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackUpdateInterface
{ {
/** /**
* @ORM\ManyToOne(
* targetEntity=AccompanyingPeriodWork::class,
* inversedBy="accompanyingPeriodWorkEvaluations"
* )
*
* @Serializer\Context(normalizationContext={"groups": {"read:accompanyingPeriodWork:light"}}, groups={"read:evaluation:include-work"}) * @Serializer\Context(normalizationContext={"groups": {"read:accompanyingPeriodWork:light"}}, groups={"read:evaluation:include-work"})
*/ */
#[Serializer\Groups(['read:evaluation:include-work'])] #[Serializer\Groups(['read:evaluation:include-work'])]
#[ORM\ManyToOne(targetEntity: AccompanyingPeriodWork::class, inversedBy: 'accompanyingPeriodWorkEvaluations')]
private ?AccompanyingPeriodWork $accompanyingPeriodWork = null; private ?AccompanyingPeriodWork $accompanyingPeriodWork = null;
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])] #[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $comment = ''; private string $comment = '';
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $createdAt = null; private ?\DateTimeImmutable $createdAt = null;
/**
* @ORM\ManyToOne(
* targetEntity=User::class
* )
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: User::class)]
private ?User $createdBy = null; private ?User $createdBy = null;
/** /**
@ -65,42 +51,28 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU
* *
* @see{Chill\PersonBundle\Serializer\Normalizer\AccompanyingPeriodWorkEvaluationDenormalizer} * @see{Chill\PersonBundle\Serializer\Normalizer\AccompanyingPeriodWorkEvaluationDenormalizer}
* *
* @ORM\OneToMany(
* targetEntity=AccompanyingPeriodWorkEvaluationDocument::class,
* mappedBy="accompanyingPeriodWorkEvaluation",
* cascade={"remove", "persist"},
* orphanRemoval=true
* )
* *
* @ORM\OrderBy({"createdAt": "DESC", "id": "DESC"})
* *
* @var Collection<AccompanyingPeriodWorkEvaluationDocument> * @var Collection<AccompanyingPeriodWorkEvaluationDocument>
*/ */
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\OneToMany(targetEntity: AccompanyingPeriodWorkEvaluationDocument::class, mappedBy: 'accompanyingPeriodWorkEvaluation', cascade: ['remove', 'persist'], orphanRemoval: true)]
#[ORM\OrderBy(['createdAt' => \Doctrine\Common\Collections\Criteria::DESC, 'id' => 'DESC'])]
private Collection $documents; private Collection $documents;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])] #[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $endDate = null; private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\ManyToOne(
* targetEntity=Evaluation::class
* )
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work_evaluation:create'])] #[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work_evaluation:create'])]
#[ORM\ManyToOne(targetEntity: Evaluation::class)]
private ?Evaluation $evaluation = null; private ?Evaluation $evaluation = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/** /**
@ -113,42 +85,28 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU
#[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])] #[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])]
private $key; private $key;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])] #[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $maxDate = null; private ?\DateTimeImmutable $maxDate = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])] #[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $startDate = null; private ?\DateTimeImmutable $startDate = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $updatedAt = null; private ?\DateTimeImmutable $updatedAt = null;
/**
* @ORM\ManyToOne(
* targetEntity=User::class
* )
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: User::class)]
private ?User $updatedBy = null; private ?User $updatedBy = null;
/**
* @ORM\Column(type="dateinterval", nullable=true, options={"default": null})
*/
#[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])] #[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATEINTERVAL, nullable: true, options: ['default' => null])]
private ?\DateInterval $warningInterval = null; private ?\DateInterval $warningInterval = null;
/**
* @ORM\Column(type="integer", nullable=true)
*/
#[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])] #[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true)]
private ?int $timeSpent = null; private ?int $timeSpent = null;
public function __construct() public function __construct()

View File

@ -19,38 +19,31 @@ use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
*
* @ORM\Table("chill_person_accompanying_period_work_evaluation_document")
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work_evaluation_document' => AccompanyingPeriodWorkEvaluationDocument::class])] #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work_evaluation_document' => AccompanyingPeriodWorkEvaluationDocument::class])]
#[ORM\Entity]
#[ORM\Table('chill_person_accompanying_period_work_evaluation_document')]
class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doctrine\Model\TrackCreationInterface, \Chill\MainBundle\Doctrine\Model\TrackUpdateInterface class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doctrine\Model\TrackCreationInterface, \Chill\MainBundle\Doctrine\Model\TrackUpdateInterface
{ {
use TrackCreationTrait; use TrackCreationTrait;
use TrackUpdateTrait; use TrackUpdateTrait;
/** #[ORM\ManyToOne(targetEntity: AccompanyingPeriodWorkEvaluation::class, inversedBy: 'documents')]
* @ORM\ManyToOne(
* targetEntity=AccompanyingPeriodWorkEvaluation::class,
* inversedBy="documents"
* )
*/
private ?AccompanyingPeriodWorkEvaluation $accompanyingPeriodWorkEvaluation = null; private ?AccompanyingPeriodWorkEvaluation $accompanyingPeriodWorkEvaluation = null;
/** /**
* @ORM\Id
* *
* @ORM\GeneratedValue
* *
* @ORM\Column(type="integer")
* *
* @internal the default name exceeds 64 characters, we must set manually: * @internal the default name exceeds 64 characters, we must set manually:
* *
* @ORM\SequenceGenerator(sequenceName="chill_person_social_work_eval_doc_id_seq", allocationSize=1, initialValue=1000)
*/ */
#[Serializer\Groups(['read', 'accompanying_period_work_evaluation:create'])] #[Serializer\Groups(['read', 'accompanying_period_work_evaluation:create'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\SequenceGenerator(sequenceName: 'chill_person_social_work_eval_doc_id_seq', allocationSize: 1, initialValue: 1000)]
private ?int $id = null; private ?int $id = null;
/** /**
@ -63,27 +56,17 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct
#[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])] #[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])]
private $key; private $key;
/**
* @ORM\ManyToOne(
* targetEntity=StoredObject::class,
* )
*/
#[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])] #[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])]
#[Assert\Valid] #[Assert\Valid]
#[ORM\ManyToOne(targetEntity: StoredObject::class)]
private ?StoredObject $storedObject = null; private ?StoredObject $storedObject = null;
/**
* @ORM\ManyToOne(
* targetEntity=DocGeneratorTemplate::class
* )
*/
#[Serializer\Groups(['read', 'accompanying_period_work_evaluation:create'])] #[Serializer\Groups(['read', 'accompanying_period_work_evaluation:create'])]
#[ORM\ManyToOne(targetEntity: DocGeneratorTemplate::class)]
private ?DocGeneratorTemplate $template = null; private ?DocGeneratorTemplate $template = null;
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])] #[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private ?string $title = ''; private ?string $title = '';
public function getAccompanyingPeriodWorkEvaluation(): ?AccompanyingPeriodWorkEvaluation public function getAccompanyingPeriodWorkEvaluation(): ?AccompanyingPeriodWorkEvaluation

View File

@ -18,49 +18,38 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
/**
* @ORM\Entity
*
* @ORM\Table(name="chill_person_accompanying_period_work_goal")
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work_goal' => AccompanyingPeriodWorkGoal::class])] #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work_goal' => AccompanyingPeriodWorkGoal::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_accompanying_period_work_goal')]
class AccompanyingPeriodWorkGoal class AccompanyingPeriodWorkGoal
{ {
/** #[ORM\ManyToOne(targetEntity: AccompanyingPeriodWork::class, inversedBy: 'goals')]
* @ORM\ManyToOne(targetEntity=AccompanyingPeriodWork::class, inversedBy="goals")
*/
private ?AccompanyingPeriodWork $accompanyingPeriodWork = null; private ?AccompanyingPeriodWork $accompanyingPeriodWork = null;
/**
* @ORM\ManyToOne(targetEntity=Goal::class)
*/
#[Serializer\Groups(['accompanying_period_work:edit', 'read', 'docgen:read'])] #[Serializer\Groups(['accompanying_period_work:edit', 'read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: Goal::class)]
private ?Goal $goal = null; private ?Goal $goal = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/**
* @ORM\Column(type="text")
*/
#[Serializer\Groups(['accompanying_period_work:edit', 'read'])] #[Serializer\Groups(['accompanying_period_work:edit', 'read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
private string $note = ''; private string $note = '';
/** /**
* @var Collection<Result> * @var Collection<Result>
* *
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorkGoals")
* *
* @ORM\JoinTable(name="chill_person_accompanying_period_work_goal_result")
*/ */
#[Serializer\Groups(['accompanying_period_work:edit', 'read', 'docgen:read'])] #[Serializer\Groups(['accompanying_period_work:edit', 'read', 'docgen:read'])]
#[ORM\ManyToMany(targetEntity: Result::class, inversedBy: 'accompanyingPeriodWorkGoals')]
#[ORM\JoinTable(name: 'chill_person_accompanying_period_work_goal_result')]
private Collection $results; private Collection $results;
public function __construct() public function __construct()

View File

@ -18,46 +18,35 @@ use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\User;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Table(name: 'chill_person_accompanying_period_work_referrer')]
* @ORM\Table(name="chill_person_accompanying_period_work_referrer")
*/
class AccompanyingPeriodWorkReferrerHistory implements TrackCreationInterface, TrackUpdateInterface class AccompanyingPeriodWorkReferrerHistory implements TrackCreationInterface, TrackUpdateInterface
{ {
use TrackCreationTrait; use TrackCreationTrait;
use TrackUpdateTrait; use TrackUpdateTrait;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
private ?\DateTimeImmutable $endDate = null; private ?\DateTimeImmutable $endDate = null;
public function __construct( public function __construct(
/** #[ORM\ManyToOne(targetEntity: AccompanyingPeriodWork::class, inversedBy: 'referrersHistory')]
* @ORM\ManyToOne(targetEntity=AccompanyingPeriodWork::class, inversedBy="referrersHistory")
*/
private ?AccompanyingPeriodWork $accompanyingPeriodWork, private ?AccompanyingPeriodWork $accompanyingPeriodWork,
/** /**
* @var User * @var User
*
* @ORM\ManyToOne(targetEntity=User::class)
*/ */
#[ORM\ManyToOne(targetEntity: User::class)]
private User $user, private User $user,
/** /**
* @var \DateTimeImmutable * @var \DateTimeImmutable
*
* @ORM\Column(type="date_immutable", nullable=false)
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: false)]
private \DateTimeImmutable $startDate private \DateTimeImmutable $startDate
) {} ) {}

View File

@ -19,61 +19,44 @@ use Symfony\Component\Serializer\Annotation as Serializer;
/** /**
* ClosingMotive give an explanation why we closed the Accompanying period. * ClosingMotive give an explanation why we closed the Accompanying period.
* *
* @ORM\Entity
* *
* @ORM\Table(name="chill_person_accompanying_period_closingmotive")
*/ */
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_accompanying_period_closingmotive')]
class ClosingMotive class ClosingMotive
{ {
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
* @ORM\Column(type="boolean")
*/
private bool $active = true; private bool $active = true;
/** /**
* Child Accompanying periods. * Child Accompanying periods.
* *
* @var Collection<ClosingMotive> * @var Collection<ClosingMotive>
*
* @ORM\OneToMany(
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive",
* mappedBy="parent")
*/ */
#[ORM\OneToMany(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive::class, mappedBy: 'parent')]
private Collection $children; private Collection $children;
/**
* @ORM\Id
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[Serializer\Groups(['docgen:read'])] #[Serializer\Groups(['docgen:read'])]
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null; private ?int $id = null;
/** /**
* @ORM\Column(type="json")
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/ */
#[Serializer\Groups(['docgen:read'])] #[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $name = []; private array $name = [];
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
* @ORM\Column(type="float")
*/
private float $ordering = 0.0; private float $ordering = 0.0;
/** #[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive::class, inversedBy: 'children')]
* @ORM\ManyToOne(
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive",
* inversedBy="children")
*/
private ?ClosingMotive $parent = null; private ?ClosingMotive $parent = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: false, options: ['default' => false])]
* @ORM\Column(type="boolean", nullable=false, options={"default": false})
*/
private bool $isCanceledAccompanyingPeriod = false; private bool $isCanceledAccompanyingPeriod = false;
/** /**

View File

@ -20,67 +20,48 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
*
* @ORM\Table(name="chill_person_accompanying_period_comment")
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_comment' => Comment::class])] #[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_comment' => Comment::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_accompanying_period_comment')]
class Comment implements TrackCreationInterface, TrackUpdateInterface class Comment implements TrackCreationInterface, TrackUpdateInterface
{ {
/**
* @ORM\ManyToOne( #[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod::class, inversedBy: 'comments')]
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod", #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
* inversedBy="comments")
*
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
*/
private ?AccompanyingPeriod $accompanyingPeriod = null; private ?AccompanyingPeriod $accompanyingPeriod = null;
/**
* @ORM\Column(type="text", nullable=false, options={"default":""})
*/
#[Groups(['read', 'write', 'docgen:read'])] #[Groups(['read', 'write', 'docgen:read'])]
#[Assert\NotBlank] #[Assert\NotBlank]
#[Assert\NotNull] #[Assert\NotNull]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $content = ''; private string $content = '';
/**
* @ORM\Column(type="datetime")
*/
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $createdAt = null; private ?\DateTimeInterface $createdAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: false)]
private ?User $creator = null; private ?User $creator = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/**
* @ORM\Column(type="datetime")
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $updatedAt = null; private ?\DateTimeInterface $updatedAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[Groups(['read'])] #[Groups(['read'])]
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: false)]
private ?User $updatedBy = null; private ?User $updatedBy = null;
public function getAccompanyingPeriod(): ?AccompanyingPeriod public function getAccompanyingPeriod(): ?AccompanyingPeriod

View File

@ -14,36 +14,28 @@ namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
/**
* @ORM\Entity
*
* @ORM\Table(name="chill_person_accompanying_period_origin")
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['origin' => Origin::class])] #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['origin' => Origin::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_accompanying_period_origin')]
class Origin class Origin
{ {
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/** /**
* @ORM\Column(type="json")
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/ */
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $label = []; private array $label = [];
/**
* @ORM\Column(type="date_immutable", nullable=true)
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true)]
private ?\DateTimeImmutable $noActiveAfter = null; private ?\DateTimeImmutable $noActiveAfter = null;
public function getId(): ?int public function getId(): ?int

View File

@ -21,64 +21,44 @@ use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* **About denormalization**: this operation is operated by @see{AccompanyingPeriodResourdeNormalizer}. * **About denormalization**: this operation is operated by @see{AccompanyingPeriodResourdeNormalizer}.
* *
* @ORM\Entity
* *
* @ORM\Table(
* name="chill_person_accompanying_period_resource",
* uniqueConstraints={
* *
* @ORM\UniqueConstraint(name="person_unique", columns={"person_id", "accompanyingperiod_id"}),
* @ORM\UniqueConstraint(name="thirdparty_unique", columns={"thirdparty_id", "accompanyingperiod_id"})
* }
* )
* @ORM\UniqueConstraint(name="person_unique", columns={"person_id", "accompanyingperiod_id"}),
* @ORM\UniqueConstraint(name="thirdparty_unique", columns={"thirdparty_id", "accompanyingperiod_id"})
* }
* )
*/ */
#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_resource' => Resource::class])] #[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_resource' => Resource::class])]
#[ORM\Entity]
#[ORM\UniqueConstraint(name: 'person_unique', columns: ['person_id', 'accompanyingperiod_id'])] // ,
#[ORM\UniqueConstraint(name: 'thirdparty_unique', columns: ['thirdparty_id', 'accompanyingperiod_id'])]
#[ORM\Table(name: 'chill_person_accompanying_period_resource')]
#[ORM\UniqueConstraint(name: 'person_unique', columns: ['person_id', 'accompanyingperiod_id'])]
#[ORM\UniqueConstraint(name: 'thirdparty_unique', columns: ['thirdparty_id', 'accompanyingperiod_id'])]
class Resource class Resource
{ {
/**
* @ORM\ManyToOne( #[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod::class, inversedBy: 'resources')]
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod", #[ORM\JoinColumn(nullable: false)]
* inversedBy="resources"
* )
*
* @ORM\JoinColumn(nullable=false)
*/
private ?AccompanyingPeriod $accompanyingPeriod = null; private ?AccompanyingPeriod $accompanyingPeriod = null;
/**
* @ORM\Column(type="text", nullable=true)
*/
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
private ?string $comment = ''; private ?string $comment = '';
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=Person::class)
*
* @ORM\JoinColumn(nullable=true)
*/
#[Groups(['docgen:read'])] #[Groups(['docgen:read'])]
#[ORM\ManyToOne(targetEntity: Person::class)]
#[ORM\JoinColumn(nullable: true)]
private ?Person $person = null; private ?Person $person = null;
/**
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
*
* @ORM\JoinColumn(nullable=true)
*/
#[Groups(['docgen:read'])] #[Groups(['docgen:read'])]
#[ORM\ManyToOne(targetEntity: ThirdParty::class)]
#[ORM\JoinColumn(nullable: true)]
private ?ThirdParty $thirdParty = null; private ?ThirdParty $thirdParty = null;
public function getAccompanyingPeriod(): ?AccompanyingPeriod public function getAccompanyingPeriod(): ?AccompanyingPeriod

View File

@ -17,46 +17,33 @@ use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Table('chill_person_accompanying_period_user_history')]
* @ORM\Table("chill_person_accompanying_period_user_history")
*/
class UserHistory implements TrackCreationInterface class UserHistory implements TrackCreationInterface
{ {
use TrackCreationTrait; use TrackCreationTrait;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true, options: ['default' => null])]
* @ORM\Column(type="datetime_immutable", nullable=true, options={"default": null})
*/
private ?\DateTimeImmutable $endDate = null; private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(name="id", type="integer") #[ORM\GeneratedValue(strategy: 'AUTO')]
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null; private ?int $id = null;
public function __construct( public function __construct(
/**
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class, inversedBy="userHistories") #[ORM\ManyToOne(targetEntity: AccompanyingPeriod::class, inversedBy: 'userHistories')]
* #[ORM\JoinColumn(nullable: false)]
* @ORM\JoinColumn(nullable=false)
*/
private ?AccompanyingPeriod $accompanyingPeriod, private ?AccompanyingPeriod $accompanyingPeriod,
/**
* @ORM\ManyToOne(targetEntity=User::class) #[ORM\ManyToOne(targetEntity: User::class)]
* #[ORM\JoinColumn(nullable: false)]
* @ORM\JoinColumn(nullable=false)
*/
private User $user, private User $user,
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false, options: ['default' => 'now()'])]
* @ORM\Column(type="datetime_immutable", nullable=false, options={"default": "now()"})
*/
private \DateTimeImmutable $startDate = new \DateTimeImmutable('now') private \DateTimeImmutable $startDate = new \DateTimeImmutable('now')
) {} ) {}

View File

@ -18,46 +18,33 @@ use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* AccompanyingPeriodParticipation Class. * AccompanyingPeriodParticipation Class.
* *
* @ORM\Entity
* *
* @ORM\Table(name="chill_person_accompanying_period_participation")
*/ */
#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_participation' => AccompanyingPeriodParticipation::class])] #[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_participation' => AccompanyingPeriodParticipation::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_accompanying_period_participation')]
class AccompanyingPeriodParticipation class AccompanyingPeriodParticipation
{ {
/**
* @ORM\Column(type="date", nullable=true)
*/
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)]
private ?\DateTime $endDate = null; private ?\DateTime $endDate = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/**
* @ORM\Column(type="date", nullable=false)
*/
#[Groups(['read', 'docgen:read'])] #[Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: false)]
private ?\DateTime $startDate = null; private ?\DateTime $startDate = null;
public function __construct(/** public function __construct(
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class, inversedBy="participations", cascade={"persist"}) #[ORM\ManyToOne(targetEntity: AccompanyingPeriod::class, inversedBy: 'participations', cascade: ['persist'])]
* #[ORM\JoinColumn(name: 'accompanyingperiod_id', referencedColumnName: 'id', nullable: false)]
* @ORM\JoinColumn(name="accompanyingperiod_id", referencedColumnName="id", nullable=false) private ?AccompanyingPeriod $accompanyingPeriod,
*/ #[Groups(['read', 'docgen:read'])] #[ORM\ManyToOne(targetEntity: Person::class, inversedBy: 'accompanyingPeriodParticipations')] #[ORM\JoinColumn(name: 'person_id', referencedColumnName: 'id', nullable: false)]
private ?AccompanyingPeriod $accompanyingPeriod, /**
* @ORM\ManyToOne(targetEntity=Person::class, inversedBy="accompanyingPeriodParticipations")
*
* @ORM\JoinColumn(name="person_id", referencedColumnName="id", nullable=false)
*/
#[Groups(['read', 'docgen:read'])]
private ?Person $person private ?Person $person
) { ) {
$this->startDate = new \DateTime('now'); $this->startDate = new \DateTime('now');

View File

@ -26,15 +26,13 @@ use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface;
/** /**
* @ORM\Entity
* *
* @ORM\Table(
* name="chill_person_household"
* )
* *
* @MaxHolder(groups={"household_memberships"}) * @MaxHolder(groups={"household_memberships"})
*/ */
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household' => Household::class])] #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household' => Household::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_household')]
class Household class Household
{ {
/** /**
@ -42,68 +40,48 @@ class Household
* *
* @var Collection<Address> * @var Collection<Address>
* *
* @ORM\ManyToMany(
* targetEntity="Chill\MainBundle\Entity\Address",
* cascade={"persist", "remove", "merge", "detach"})
* *
* @ORM\JoinTable(name="chill_person_household_to_addresses")
* *
* @ORM\OrderBy({"validFrom": "DESC", "id": "DESC"})
*/ */
#[Serializer\Groups(['write'])] #[Serializer\Groups(['write'])]
#[ORM\ManyToMany(targetEntity: \Chill\MainBundle\Entity\Address::class, cascade: ['persist', 'remove', 'merge', 'detach'])]
#[ORM\JoinTable(name: 'chill_person_household_to_addresses')]
#[ORM\OrderBy(['validFrom' => \Doctrine\Common\Collections\Criteria::DESC, 'id' => 'DESC'])]
private Collection $addresses; private Collection $addresses;
/** #[ORM\Embedded(class: CommentEmbeddable::class, columnPrefix: 'comment_members_')]
* @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_members_")
*/
private CommentEmbeddable $commentMembers; private CommentEmbeddable $commentMembers;
/** /**
* @var Collection&Selectable<int, HouseholdComposition> * @var Collection&Selectable<int, HouseholdComposition>
* *
* @ORM\OneToMany(
* targetEntity=HouseholdComposition::class,
* mappedBy="household",
* orphanRemoval=true,
* cascade={"persist"}
* )
* *
* @ORM\OrderBy({"startDate": "DESC"})
*/ */
#[Assert\Valid(traverse: true, groups: ['household_composition'])] #[Assert\Valid(traverse: true, groups: ['household_composition'])]
#[ORM\OneToMany(targetEntity: HouseholdComposition::class, mappedBy: 'household', orphanRemoval: true, cascade: ['persist'])]
#[ORM\OrderBy(['startDate' => \Doctrine\Common\Collections\Criteria::DESC])]
private Collection&Selectable $compositions; private Collection&Selectable $compositions;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/** /**
* @var Collection<HouseholdMember> * @var Collection<HouseholdMember>
*
* @ORM\OneToMany(
* targetEntity=HouseholdMember::class,
* mappedBy="household"
* )
*/ */
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\OneToMany(targetEntity: HouseholdMember::class, mappedBy: 'household')]
private Collection $members; private Collection $members;
/**
* @ORM\Column(type="boolean", name="waiting_for_birth", options={"default": false})
*/
#[Serializer\Groups(['docgen:read'])] #[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, name: 'waiting_for_birth', options: ['default' => false])]
private bool $waitingForBirth = false; private bool $waitingForBirth = false;
/**
* @ORM\Column(type="date_immutable", name="waiting_for_birth_date", nullable=true, options={"default": null})
*/
#[Serializer\Groups(['docgen:read'])] #[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, name: 'waiting_for_birth_date', nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $waitingForBirthDate = null; private ?\DateTimeImmutable $waitingForBirthDate = null;
public function __construct() public function __construct()

View File

@ -20,70 +20,51 @@ use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
*
* @ORM\Table(
* name="chill_person_household_composition"
* )
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_composition_type' => HouseholdCompositionType::class])] #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_composition_type' => HouseholdCompositionType::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_household_composition')]
class HouseholdComposition implements TrackCreationInterface, TrackUpdateInterface class HouseholdComposition implements TrackCreationInterface, TrackUpdateInterface
{ {
use TrackCreationTrait; use TrackCreationTrait;
use TrackUpdateTrait; use TrackUpdateTrait;
/** #[ORM\Embedded(class: CommentEmbeddable::class, columnPrefix: 'comment_')]
* @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_")
*/
private CommentEmbeddable $comment; private CommentEmbeddable $comment;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[Assert\GreaterThanOrEqual(propertyPath: 'startDate', groups: ['Default', 'household_composition'])] #[Assert\GreaterThanOrEqual(propertyPath: 'startDate', groups: ['Default', 'household_composition'])]
#[Serializer\Groups(['docgen:read'])] #[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $endDate = null; private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\ManyToOne(targetEntity=Household::class, inversedBy="compositions") #[ORM\ManyToOne(targetEntity: Household::class, inversedBy: 'compositions')]
* #[ORM\JoinColumn(nullable: false)]
* @ORM\JoinColumn(nullable=false)
*/
private ?Household $household = null; private ?Household $household = null;
/**
* @ORM\ManyToOne(targetEntity=HouseholdCompositionType::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[Serializer\Groups(['docgen:read'])] #[Serializer\Groups(['docgen:read'])]
#[ORM\ManyToOne(targetEntity: HouseholdCompositionType::class)]
#[ORM\JoinColumn(nullable: false)]
private ?HouseholdCompositionType $householdCompositionType = null; private ?HouseholdCompositionType $householdCompositionType = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/**
* @ORM\Column(type="integer", nullable=true, options={"default": null})
*/
#[Assert\NotNull] #[Assert\NotNull]
#[Assert\GreaterThanOrEqual(0, groups: ['Default', 'household_composition'])] #[Assert\GreaterThanOrEqual(0, groups: ['Default', 'household_composition'])]
#[Serializer\Groups(['docgen:read'])] #[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true, options: ['default' => null])]
private ?int $numberOfChildren = null; private ?int $numberOfChildren = null;
/**
* @ORM\Column(type="date_immutable", nullable=false)
*/
#[Assert\NotNull(groups: ['Default', 'household_composition'])] #[Assert\NotNull(groups: ['Default', 'household_composition'])]
#[Serializer\Groups(['docgen:read'])] #[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: false)]
private ?\DateTimeImmutable $startDate = null; private ?\DateTimeImmutable $startDate = null;
public function __construct() public function __construct()

View File

@ -14,37 +14,27 @@ namespace Chill\PersonBundle\Entity\Household;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
/**
* @ORM\Entity
*
* @ORM\Table(
* name="chill_person_household_composition_type"
* )
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_composition_type' => HouseholdCompositionType::class])] #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_composition_type' => HouseholdCompositionType::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_household_composition_type')]
class HouseholdCompositionType class HouseholdCompositionType
{ {
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
* @ORM\Column(type="boolean")
*/
private bool $active = true; private bool $active = true;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/** /**
* @ORM\Column(type="json")
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/ */
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $label = []; private array $label = [];
public function getId(): ?int public function getId(): ?int

View File

@ -16,81 +16,55 @@ use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity #[ORM\Entity]
* #[ORM\Table(name: 'chill_person_household_members')]
* @ORM\Table(
* name="chill_person_household_members"
* )
*/
class HouseholdMember class HouseholdMember
{ {
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
private ?string $comment = null; private ?string $comment = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[Assert\GreaterThanOrEqual(propertyPath: 'startDate', message: 'household_membership.The end date must be after start date', groups: ['household_memberships'])] #[Assert\GreaterThanOrEqual(propertyPath: 'startDate', message: 'household_membership.The end date must be after start date', groups: ['household_memberships'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $endDate = null; private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
private bool $holder = false; private bool $holder = false;
/**
* @ORM\ManyToOne(
* targetEntity="\Chill\PersonBundle\Entity\Household\Household"
* )
*/
#[Assert\Valid(groups: ['household_memberships'])] #[Assert\Valid(groups: ['household_memberships'])]
#[Assert\NotNull(groups: ['household_memberships'])] #[Assert\NotNull(groups: ['household_memberships'])]
#[ORM\ManyToOne(targetEntity: Household::class)]
private ?Household $household = null; private ?Household $household = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/** /**
* @ORM\ManyToOne(
* targetEntity="\Chill\PersonBundle\Entity\Person"
* )
*
* @Serializer\Context({"docgen:person:with-household": false}) * @Serializer\Context({"docgen:person:with-household": false})
*/ */
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[Assert\Valid(groups: ['household_memberships'])] #[Assert\Valid(groups: ['household_memberships'])]
#[Assert\NotNull(groups: ['household_memberships'])] #[Assert\NotNull(groups: ['household_memberships'])]
#[ORM\ManyToOne(targetEntity: Person::class)]
private ?Person $person = null; private ?Person $person = null;
/**
* @ORM\ManyToOne(targetEntity=Position::class)
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: Position::class)]
private ?Position $position = null; private ?Position $position = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, name: 'sharedhousehold')]
* @ORM\Column(type="boolean", name="sharedhousehold")
*/
private bool $shareHousehold = true; private bool $shareHousehold = true;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[Assert\NotNull(groups: ['household_memberships'])] #[Assert\NotNull(groups: ['household_memberships'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $startDate = null; private ?\DateTimeImmutable $startDate = null;
public function getComment(): ?string public function getComment(): ?string

View File

@ -39,47 +39,34 @@ use Doctrine\ORM\Mapping as ORM;
* 2. 2st entity: from 2021-06-01 to 2021-12-01, household W, address R; * 2. 2st entity: from 2021-06-01 to 2021-12-01, household W, address R;
* 3. 3st entity: from 2021-12-01 to NULL, household V, address T; * 3. 3st entity: from 2021-12-01 to NULL, household V, address T;
* *
* @ORM\Entity(readOnly=true)
* *
* @ORM\Table(name="view_chill_person_household_address")
*/ */
#[ORM\Entity(readOnly: true)]
#[ORM\Table(name: 'view_chill_person_household_address')]
class PersonHouseholdAddress class PersonHouseholdAddress
{ {
/**
* @ORM\Id #[ORM\Id]
* #[ORM\ManyToOne(targetEntity: Address::class)]
* @ORM\ManyToOne(targetEntity=Address::class) #[ORM\JoinColumn(nullable: false)]
*
* @ORM\JoinColumn(nullable=false)
*/
private ?Address $address = null; private ?Address $address = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\ManyToOne(targetEntity: Household::class)]
* @ORM\ManyToOne(targetEntity=Household::class) #[ORM\JoinColumn(nullable: false)]
*
* @ORM\JoinColumn(nullable=false)
*/
private ?Household $household = null; private ?Household $household = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\ManyToOne(targetEntity: Person::class)]
* @ORM\ManyToOne(targetEntity=Person::class) #[ORM\JoinColumn(nullable: false)]
*
* @ORM\JoinColumn(nullable=false)
*/
private ?Person $person = null; private ?Person $person = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE)]
* @ORM\Column(type="date_immutable")
*/
private $validFrom; private $validFrom;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true)]
* @ORM\Column(type="date_immutable", nullable=true)
*/
private $validTo; private $validTo;
public function getAddress(): ?Address public function getAddress(): ?Address

View File

@ -14,48 +14,36 @@ namespace Chill\PersonBundle\Entity\Household;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation as Serializer;
/**
* @ORM\Entity
*
* @ORM\Table(name="chill_person_household_position")
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_position' => Position::class])] #[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_position' => Position::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_household_position')]
class Position class Position
{ {
/**
* @ORM\Column(type="boolean")
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $allowHolder = false; private bool $allowHolder = false;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null; private ?int $id = null;
/** /**
* @ORM\Column(type="json")
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/ */
#[Serializer\Groups(['read', 'docgen:read'])] #[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $label = []; private array $label = [];
/**
* @ORM\Column(type="float")
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
private float $ordering = 0.00; private float $ordering = 0.00;
/**
* @ORM\Column(type="boolean")
*/
#[Serializer\Groups(['read'])] #[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $shareHouseHold = true; private bool $shareHouseHold = true;
public function getAllowHolder(): bool public function getAllowHolder(): bool

View File

@ -16,24 +16,20 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* MaritalStatus. * MaritalStatus.
* *
* @ORM\Entity
* *
* @ORM\Table(name="chill_person_marital_status")
* *
* @ORM\HasLifecycleCallbacks
*/ */
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'chill_person_marital_status')]
class MaritalStatus class MaritalStatus
{ {
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 7)]
* @ORM\Column(type="string", length=7)
*/
private ?string $id; private ?string $id;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
* @ORM\Column(type="json")
*/
private array $name; private array $name;
public function __construct() public function __construct()

View File

@ -48,39 +48,23 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
/** /**
* Person Class. * Person Class.
* *
* @ORM\Entity
* *
* @ORM\Table(name="chill_person_person",
* indexes={
* *
* @ORM\Index(
* name="person_names",
* columns={"firstName", "lastName"}
* ),
* @ORM\Index(
* name="person_birthdate",
* columns={"birthdate"}
* )
* })
* @ORM\Index(
* name="person_names",
* columns={"firstName", "lastName"}
* ),
* @ORM\Index(
* name="person_birthdate",
* columns={"birthdate"}
* )
* })
* *
* @ORM\HasLifecycleCallbacks *
*
* *
* @PersonHasCenter * @PersonHasCenter
*
* @HouseholdMembershipSequential( * @HouseholdMembershipSequential(
* groups={"household_memberships"} * groups={"household_memberships"}
* ) * )
*/ */
#[DiscriminatorMap(typeProperty: 'type', mapping: ['person' => Person::class])] #[DiscriminatorMap(typeProperty: 'type', mapping: ['person' => Person::class])]
#[ORM\Entity]
#[ORM\Index(name: 'person_names', columns: ['firstName', 'lastName'])] // ,
#[ORM\Index(name: 'person_birthdate', columns: ['birthdate'])] // @ORM\HasLifecycleCallbacks
#[ORM\Table(name: 'chill_person_person')]
#[ORM\HasLifecycleCallbacks]
class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateInterface, \Stringable class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateInterface, \Stringable
{ {
final public const BOTH_GENDER = 'both'; final public const BOTH_GENDER = 'both';
@ -98,16 +82,14 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
/** /**
* Accept receiving email. * Accept receiving email.
*
* @ORM\Column(type="boolean", options={"default": false})
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
private ?bool $acceptEmail = false; private ?bool $acceptEmail = false;
/** /**
* Accept short text message (aka SMS). * Accept short text message (aka SMS).
*
* @ORM\Column(type="boolean", options={"default": false})
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
private ?bool $acceptSMS = false; private ?bool $acceptSMS = false;
/** /**
@ -115,22 +97,19 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* *
* @var Collection<AccompanyingPeriodParticipation> * @var Collection<AccompanyingPeriodParticipation>
* *
* @ORM\OneToMany(targetEntity=AccompanyingPeriodParticipation::class,
* mappedBy="person",
* cascade={"persist", "remove", "merge", "detach"})
* *
* @ORM\OrderBy({"startDate": "DESC"})
*/ */
#[ORM\OneToMany(targetEntity: AccompanyingPeriodParticipation::class, mappedBy: 'person', cascade: ['persist', 'remove', 'merge', 'detach'])]
#[ORM\OrderBy(['startDate' => \Doctrine\Common\Collections\Criteria::DESC])]
private Collection $accompanyingPeriodParticipations; private Collection $accompanyingPeriodParticipations;
/** /**
* The accompanying period requested by the Person. * The accompanying period requested by the Person.
* *
* @ORM\OneToMany(targetEntity=AccompanyingPeriod::class,
* mappedBy="requestorPerson")
* *
* @var Collection<AccompanyingPeriod> * @var Collection<AccompanyingPeriod>
*/ */
#[ORM\OneToMany(targetEntity: AccompanyingPeriod::class, mappedBy: 'requestorPerson')]
private Collection $accompanyingPeriodRequested; private Collection $accompanyingPeriodRequested;
/** /**
@ -138,131 +117,101 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* *
* @var Collection<Address> * @var Collection<Address>
* *
* @ORM\ManyToMany(
* targetEntity="Chill\MainBundle\Entity\Address",
* cascade={"persist", "remove", "merge", "detach"})
* *
* @ORM\JoinTable(name="chill_person_persons_to_addresses")
* *
* @ORM\OrderBy({"validFrom": "DESC"})
*/ */
#[ORM\ManyToMany(targetEntity: \Chill\MainBundle\Entity\Address::class, cascade: ['persist', 'remove', 'merge', 'detach'])]
#[ORM\JoinTable(name: 'chill_person_persons_to_addresses')]
#[ORM\OrderBy(['validFrom' => \Doctrine\Common\Collections\Criteria::DESC])]
private Collection $addresses; private Collection $addresses;
/** /**
* @var Collection<PersonAltName> * @var Collection<PersonAltName>
*
* @ORM\OneToMany(
* targetEntity="Chill\PersonBundle\Entity\PersonAltName",
* mappedBy="person",
* cascade={"persist", "remove", "merge", "detach"},
* orphanRemoval=true)
*/ */
#[ORM\OneToMany(targetEntity: \Chill\PersonBundle\Entity\PersonAltName::class, mappedBy: 'person', cascade: ['persist', 'remove', 'merge', 'detach'], orphanRemoval: true)]
private Collection $altNames; private Collection $altNames;
/** /**
* The person's birthdate. * The person's birthdate.
* *
* @ORM\Column(type="date", nullable=true)
* *
* @Birthdate * @Birthdate
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)]
private ?\DateTime $birthdate = null; private ?\DateTime $birthdate = null;
/** /**
* @var Collection<Charge> * @var Collection<Charge>
*
* @ORM\OneToMany(
* targetEntity=Charge::class,
* mappedBy="person"
* )
*/ */
#[ORM\OneToMany(targetEntity: Charge::class, mappedBy: 'person')]
private Collection $budgetCharges; private Collection $budgetCharges;
/** /**
* @var Collection<resource> * @var Collection<resource>
*
* @ORM\OneToMany(
* targetEntity=Resource::class,
* mappedBy="person"
* )
*/ */
#[ORM\OneToMany(targetEntity: Resource::class, mappedBy: 'person')]
private Collection $budgetResources; private Collection $budgetResources;
/** /**
* @var Collection<int, Calendar> * @var Collection<int, Calendar>
*
* @ORM\ManyToMany(
* targetEntity="Chill\CalendarBundle\Entity\Calendar",
* mappedBy="persons"
* )
*/ */
#[ORM\ManyToMany(targetEntity: \Chill\CalendarBundle\Entity\Calendar::class, mappedBy: 'persons')]
private Collection $calendars; private Collection $calendars;
/** /**
* The person's center. * The person's center.
* *
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center")
* *
* @deprecated * @deprecated
*/ */
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Center::class)]
private ?Center $center = null; private ?Center $center = null;
/** #[ORM\OneToOne(targetEntity: PersonCenterCurrent::class, mappedBy: 'person')]
* @ORM\OneToOne(targetEntity=PersonCenterCurrent::class, mappedBy="person")
*/
private ?PersonCenterCurrent $centerCurrent = null; private ?PersonCenterCurrent $centerCurrent = null;
/** /**
* @ORM\OneToMany(targetEntity=PersonCenterHistory::class, mappedBy="person", cascade={"persist", "remove"})
*
* @var Collection<PersonCenterHistory> * @var Collection<PersonCenterHistory>
*/ */
#[ORM\OneToMany(targetEntity: PersonCenterHistory::class, mappedBy: 'person', cascade: ['persist', 'remove'])]
private Collection $centerHistory; private Collection $centerHistory;
/** /**
* Array where customfield's data are stored. * Array where customfield's data are stored.
*
* @ORM\Column(type="json")
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private ?array $cFData = null; private ?array $cFData = null;
/** /**
* The marital status of the person. * The marital status of the person.
* *
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Civility")
* *
* @ORM\JoinColumn(nullable=true)
*/ */
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Civility::class)]
#[ORM\JoinColumn(nullable: true)]
private ?Civility $civility = null; private ?Civility $civility = null;
/** /**
* Contact information for contacting the person. * Contact information for contacting the person.
*
* @ORM\Column(type="text", nullable=true)
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
private ?string $contactInfo = ''; private ?string $contactInfo = '';
/** /**
* The person's country of birth. * The person's country of birth.
* *
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Country")
* *
* sf4 check: option inversedBy="birthsIn" return error mapping !!
*
* @ORM\JoinColumn(nullable=true)
*/ */
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Country::class)] // sf4 check: option inversedBy="birthsIn" return error mapping !!
#[ORM\JoinColumn(nullable: true)]
private ?Country $countryOfBirth = null; private ?Country $countryOfBirth = null;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true, options: ['default' => null])]
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
*/
private ?\DateTimeInterface $createdAt = null; private ?\DateTimeInterface $createdAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class) #[ORM\ManyToOne(targetEntity: User::class)]
* #[ORM\JoinColumn(nullable: true)]
* @ORM\JoinColumn(nullable=true)
*/
private ?User $createdBy = null; private ?User $createdBy = null;
/** /**
@ -279,214 +228,177 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* The current person address. * The current person address.
* *
* This is computed through database and is optimized on database side. * This is computed through database and is optimized on database side.
*
* @ORM\OneToOne(targetEntity=PersonCurrentAddress::class, mappedBy="person")
*/ */
#[ORM\OneToOne(targetEntity: PersonCurrentAddress::class, mappedBy: 'person')]
private ?PersonCurrentAddress $currentPersonAddress = null; private ?PersonCurrentAddress $currentPersonAddress = null;
/** /**
* The person's deathdate. * The person's deathdate.
*
* @ORM\Column(type="date_immutable", nullable=true)
*/ */
#[Assert\Date] #[Assert\Date]
#[Assert\GreaterThanOrEqual(propertyPath: 'birthdate')] #[Assert\GreaterThanOrEqual(propertyPath: 'birthdate')]
#[Assert\LessThanOrEqual('today')] #[Assert\LessThanOrEqual('today')]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true)]
private ?\DateTimeImmutable $deathdate = null; private ?\DateTimeImmutable $deathdate = null;
/** /**
* The person's email. * The person's email.
*
* @ORM\Column(type="text", nullable=true)
*/ */
#[Assert\Email] #[Assert\Email]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
private ?string $email = ''; private ?string $email = '';
/** /**
* The person's first name. * The person's first name.
*
* @ORM\Column(type="string", length=255)
*/ */
#[Assert\NotBlank(message: 'The firstname cannot be empty')] #[Assert\NotBlank(message: 'The firstname cannot be empty')]
#[Assert\Length(max: 255)] #[Assert\Length(max: 255)]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
private string $firstName = ''; private string $firstName = '';
/** /**
* fullname canonical. Read-only field, which is calculated by * fullname canonical. Read-only field, which is calculated by
* the database. * the database.
*
* @ORM\Column(type="text", nullable=true)
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
private ?string $fullnameCanonical = ''; private ?string $fullnameCanonical = '';
/** /**
* The person's gender. * The person's gender.
*
* @ORM\Column(type="string", length=9, nullable=true)
*/ */
#[Assert\NotNull(message: 'The gender must be set')] #[Assert\NotNull(message: 'The gender must be set')]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 9, nullable: true)]
private ?string $gender = null; private ?string $gender = null;
/** /**
* Comment on gender. * Comment on gender.
*
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="genderComment_")
*/ */
#[ORM\Embedded(class: \Chill\MainBundle\Entity\Embeddable\CommentEmbeddable::class, columnPrefix: 'genderComment_')]
private CommentEmbeddable $genderComment; private CommentEmbeddable $genderComment;
/** /**
* Read-only field, computed by the database. * Read-only field, computed by the database.
* *
* @var Collection<PersonHouseholdAddress> * @var Collection<PersonHouseholdAddress>
*
* @ORM\OneToMany(
* targetEntity=PersonHouseholdAddress::class,
* mappedBy="person"
* )
*/ */
#[ORM\OneToMany(targetEntity: PersonHouseholdAddress::class, mappedBy: 'person')]
private Collection $householdAddresses; private Collection $householdAddresses;
/** /**
* @ORM\OneToMany(
* targetEntity=HouseholdMember::class,
* mappedBy="person"
* )
*
* @var Collection<HouseholdMember> * @var Collection<HouseholdMember>
*/ */
#[ORM\OneToMany(targetEntity: HouseholdMember::class, mappedBy: 'person')]
private Collection $householdParticipations; private Collection $householdParticipations;
/** /**
* The person's id. * The person's id.
* *
* @ORM\Id
* *
* @ORM\Column(name="id", type="integer")
* *
* @ORM\GeneratedValue(strategy="AUTO")
*/ */
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null; private ?int $id = null;
/** /**
* The person's last name. * The person's last name.
*
* @ORM\Column(type="string", length=255)
*/ */
#[Assert\NotBlank(message: 'The lastname cannot be empty')] #[Assert\NotBlank(message: 'The lastname cannot be empty')]
#[Assert\Length(max: 255)] #[Assert\Length(max: 255)]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
private string $lastName = ''; private string $lastName = '';
/** /**
* The marital status of the person. * The marital status of the person.
* *
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\MaritalStatus")
* *
* @ORM\JoinColumn(nullable=true)
*/ */
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\MaritalStatus::class)]
#[ORM\JoinColumn(nullable: true)]
private ?MaritalStatus $maritalStatus = null; private ?MaritalStatus $maritalStatus = null;
/** /**
* Comment on marital status. * Comment on marital status.
*
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="maritalStatusComment_")
*/ */
#[ORM\Embedded(class: \Chill\MainBundle\Entity\Embeddable\CommentEmbeddable::class, columnPrefix: 'maritalStatusComment_')]
private CommentEmbeddable $maritalStatusComment; private CommentEmbeddable $maritalStatusComment;
/** /**
* The date of the last marital status change of the person. * The date of the last marital status change of the person.
*
* @ORM\Column(type="date", nullable=true)
*/ */
#[Assert\Date] #[Assert\Date]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)]
private ?\DateTime $maritalStatusDate = null; private ?\DateTime $maritalStatusDate = null;
/** /**
* A remark over the person. * A remark over the person.
*
* @ORM\Column(type="text")
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
private string $memo = ''; private string $memo = '';
/** /**
* The person's mobile phone number. * The person's mobile phone number.
* *
* @PhonenumberConstraint(type="mobile") * @PhonenumberConstraint(type="mobile")
*
* @ORM\Column(type="phone_number", nullable=true)
*/ */
#[ORM\Column(type: 'phone_number', nullable: true)]
private ?PhoneNumber $mobilenumber = null; private ?PhoneNumber $mobilenumber = null;
/** /**
* The person's nationality. * The person's nationality.
* *
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Country")
* *
* sf4 check: option inversedBy="nationals" return error mapping !!
*
* @ORM\JoinColumn(nullable=true)
*/ */
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Country::class)] // sf4 check: option inversedBy="nationals" return error mapping !!
#[ORM\JoinColumn(nullable: true)]
private ?Country $nationality = null; private ?Country $nationality = null;
/** /**
* Number of children. * Number of children.
*
* @ORM\Column(type="integer", nullable=true)
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true)]
private ?int $numberOfChildren = null; private ?int $numberOfChildren = null;
/** /**
* @var Collection<PersonPhone> * @var Collection<PersonPhone>
*
* @ORM\OneToMany(
* targetEntity="Chill\PersonBundle\Entity\PersonPhone",
* mappedBy="person",
* cascade={"persist", "remove", "merge", "detach"},
* orphanRemoval=true
* )
*/ */
#[Assert\Valid(traverse: true)] #[Assert\Valid(traverse: true)]
#[ORM\OneToMany(targetEntity: \Chill\PersonBundle\Entity\PersonPhone::class, mappedBy: 'person', cascade: ['persist', 'remove', 'merge', 'detach'], orphanRemoval: true)]
private Collection $otherPhoneNumbers; private Collection $otherPhoneNumbers;
/** /**
* @ORM\OneToMany(
* targetEntity=AccompanyingPeriod::class,
* mappedBy="personLocation"
* )
*
* @var Collection<AccompanyingPeriod> * @var Collection<AccompanyingPeriod>
*/ */
#[ORM\OneToMany(targetEntity: AccompanyingPeriod::class, mappedBy: 'personLocation')]
private Collection $periodLocatedOn; private Collection $periodLocatedOn;
/** /**
* The person's phonenumber. * The person's phonenumber.
* *
* @ORM\Column(type="phone_number", nullable=true)
* *
* @PhonenumberConstraint( * @PhonenumberConstraint(
* type="landline", * type="landline",
* ) * )
*/ */
#[ORM\Column(type: 'phone_number', nullable: true)]
private ?PhoneNumber $phonenumber = null; private ?PhoneNumber $phonenumber = null;
/** /**
* The person's place of birth. * The person's place of birth.
*
* @ORM\Column(type="string", length=255, name="place_of_birth")
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, name: 'place_of_birth')]
private string $placeOfBirth = ''; private string $placeOfBirth = '';
/** /**
* @deprecated * @deprecated
*
* @ORM\Column(type="boolean")
*/ */
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $proxyAccompanyingPeriodOpenState = false; // TO-DELETE ? private bool $proxyAccompanyingPeriodOpenState = false; // TO-DELETE ?
/** /**
* @ORM\OneToMany(targetEntity=PersonResource::class, mappedBy="personOwner")
*
* @var Collection<PersonResource> * @var Collection<PersonResource>
*/ */
#[ORM\OneToMany(targetEntity: PersonResource::class, mappedBy: 'personOwner')]
private Collection $resources; private Collection $resources;
/** /**
@ -494,26 +406,16 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* *
* @var Collection<int, Language> * @var Collection<int, Language>
* *
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\Language")
* *
* @ORM\JoinTable(
* name="persons_spoken_languages",
* joinColumns={@ORM\JoinColumn(name="person_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="language_id", referencedColumnName="id")}
* )
*/ */
#[ORM\ManyToMany(targetEntity: \Chill\MainBundle\Entity\Language::class)]
#[ORM\JoinTable(name: 'persons_spoken_languages', joinColumns: [new ORM\JoinColumn(name: 'person_id', referencedColumnName: 'id')], inverseJoinColumns: [new ORM\JoinColumn(name: 'language_id', referencedColumnName: 'id')])]
private Collection $spokenLanguages; private Collection $spokenLanguages;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true, options: ['default' => null])]
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
*/
private ?\DateTimeInterface $updatedAt = null; private ?\DateTimeInterface $updatedAt = null;
/** #[ORM\ManyToOne(targetEntity: User::class)]
* @ORM\ManyToOne(
* targetEntity=User::class
* )
*/
private ?User $updatedBy = null; private ?User $updatedBy = null;
/** /**

View File

@ -21,39 +21,29 @@ use Doctrine\ORM\Mapping as ORM;
* The process of selecting the current center is done on database side, * The process of selecting the current center is done on database side,
* using a SQL view. * using a SQL view.
* *
* @ORM\Entity(readOnly=true)
* *
* @ORM\Table(name="view_chill_person_person_center_history_current")
* *
* @psalm-internal Chill\PersonBundle\Entity * @psalm-internal Chill\PersonBundle\Entity
*/ */
#[ORM\Entity(readOnly: true)]
#[ORM\Table(name: 'view_chill_person_person_center_history_current')]
class PersonCenterCurrent class PersonCenterCurrent
{ {
/** #[ORM\ManyToOne(targetEntity: Center::class)]
* @ORM\ManyToOne(targetEntity=Center::class)
*/
private Center $center; private Center $center;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
private ?\DateTimeImmutable $endDate = null; private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
/** #[ORM\OneToOne(targetEntity: Person::class, inversedBy: 'centerCurrent')]
* @ORM\OneToOne(targetEntity=Person::class, inversedBy="centerCurrent")
*/
private Person $person; private Person $person;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: false)]
* @ORM\Column(type="date_immutable", nullable=false)
*/
private \DateTimeImmutable $startDate; private \DateTimeImmutable $startDate;
/** /**

View File

@ -22,42 +22,31 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* Associate a Person with a Center. The association may change on date intervals. * Associate a Person with a Center. The association may change on date intervals.
* *
* @ORM\Entity
* *
* @ORM\Table(name="chill_person_person_center_history")
*/ */
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_person_center_history')]
class PersonCenterHistory implements TrackCreationInterface, TrackUpdateInterface class PersonCenterHistory implements TrackCreationInterface, TrackUpdateInterface
{ {
use TrackCreationTrait; use TrackCreationTrait;
use TrackUpdateTrait; use TrackUpdateTrait;
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
private ?\DateTimeImmutable $endDate = null; private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\GeneratedValue]
* @ORM\GeneratedValue #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
*
* @ORM\Column(type="integer")
*/
private ?int $id = null; private ?int $id = null;
public function __construct( public function __construct(
/** #[ORM\ManyToOne(targetEntity: Person::class, inversedBy: 'centerHistory')]
* @ORM\ManyToOne(targetEntity=Person::class, inversedBy="centerHistory")
*/
private ?Person $person = null, private ?Person $person = null,
/** #[ORM\ManyToOne(targetEntity: Center::class)]
* @ORM\ManyToOne(targetEntity=Center::class)
*/
private ?Center $center = null, private ?Center $center = null,
/** #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: false)]
* @ORM\Column(type="date_immutable", nullable=false)
*/
private ?\DateTimeImmutable $startDate = null private ?\DateTimeImmutable $startDate = null
) {} ) {}

View File

@ -24,34 +24,25 @@ use Doctrine\ORM\Mapping as ORM;
* The validFrom and validTo properties are the intersection of * The validFrom and validTo properties are the intersection of
* household membership and address validity. See @see{PersonHouseholdAddress} * household membership and address validity. See @see{PersonHouseholdAddress}
* *
* @ORM\Entity(readOnly=true)
* *
* @ORM\Table("view_chill_person_current_address")
*/ */
#[ORM\Entity(readOnly: true)]
#[ORM\Table('view_chill_person_current_address')]
class PersonCurrentAddress class PersonCurrentAddress
{ {
/** #[ORM\OneToOne(targetEntity: Address::class)]
* @ORM\OneToOne(targetEntity=Address::class)
*/
protected Address $address; protected Address $address;
/**
* @ORM\Id #[ORM\Id]
* #[ORM\OneToOne(targetEntity: Person::class, inversedBy: 'currentPersonAddress')]
* @ORM\OneToOne(targetEntity=Person::class, inversedBy="currentPersonAddress") #[ORM\JoinColumn(name: 'person_id', referencedColumnName: 'id')]
*
* @ORM\JoinColumn(name="person_id", referencedColumnName="id")
*/
protected Person $person; protected Person $person;
/** #[ORM\Column(name: 'valid_from', type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE)]
* @ORM\Column(name="valid_from", type="date_immutable")
*/
protected \DateTimeImmutable $validFrom; protected \DateTimeImmutable $validFrom;
/** #[ORM\Column(name: 'valid_to', type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE)]
* @ORM\Column(name="valid_to", type="date_immutable")
*/
protected ?\DateTimeImmutable $validTo = null; protected ?\DateTimeImmutable $validTo = null;
public function getAddress(): Address public function getAddress(): Address

Some files were not shown because too many files have changed in this diff Show More