From 72016e1a21edfb0e98a3979bf9f2cd54f138e3a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 5 Apr 2024 00:01:30 +0200 Subject: [PATCH] Apply rector rules: add annotation for doctrine mapping --- rector.php | 1 + .../ChillActivityBundle/Entity/Activity.php | 100 +++----- .../Entity/ActivityPresence.php | 24 +- .../Entity/ActivityReason.php | 31 +-- .../Entity/ActivityReasonCategory.php | 29 +-- .../Entity/ActivityType.php | 188 ++++----------- .../Entity/ActivityTypeCategory.php | 34 +-- .../src/Entity/AsideActivity.php | 75 ++---- .../src/Entity/AsideActivityCategory.php | 42 ++-- .../Entity/AbstractElement.php | 35 +-- .../ChillBudgetBundle/Entity/Charge.php | 27 +-- .../ChillBudgetBundle/Entity/ChargeKind.php | 38 +-- .../ChillBudgetBundle/Entity/Resource.php | 23 +- .../ChillBudgetBundle/Entity/ResourceKind.php | 43 ++-- .../ChillCalendarBundle/Entity/Calendar.php | 108 +++------ .../Entity/CalendarDoc.php | 45 ++-- .../Entity/CalendarRange.php | 47 ++-- .../Entity/CancelReason.php | 31 +-- .../ChillCalendarBundle/Entity/Invite.php | 35 +-- .../Entity/RemoteCalendarTrait.php | 8 +- .../Entity/CustomField.php | 50 ++-- .../Entity/CustomFieldLongChoice/Option.php | 50 ++-- .../Entity/CustomFieldsDefaultGroup.php | 32 +-- .../Entity/CustomFieldsGroup.php | 32 +-- .../Entity/DocGeneratorTemplate.php | 44 ++-- .../Entity/AccompanyingCourseDocument.php | 27 +-- .../ChillDocStoreBundle/Entity/Document.php | 44 +--- .../Entity/DocumentCategory.php | 23 +- .../Entity/PersonDocument.php | 26 +- .../Entity/StoredObject.php | 62 ++--- .../Controller/EventController.php | 25 +- .../Controller/ParticipationController.php | 4 - src/Bundle/ChillEventBundle/Entity/Event.php | 66 ++--- .../ChillEventBundle/Entity/EventType.php | 34 +-- .../ChillEventBundle/Entity/Participation.php | 44 ++-- src/Bundle/ChillEventBundle/Entity/Role.php | 30 +-- src/Bundle/ChillEventBundle/Entity/Status.php | 30 +-- .../Controller/ExportController.php | 5 +- .../Controller/LoginController.php | 4 +- .../Controller/PasswordController.php | 2 - .../Doctrine/Model/TrackCreationTrait.php | 12 +- .../Doctrine/Model/TrackUpdateTrait.php | 12 +- src/Bundle/ChillMainBundle/Entity/Address.php | 94 +++----- .../Entity/AddressReference.php | 73 ++---- src/Bundle/ChillMainBundle/Entity/Center.php | 36 +-- .../ChillMainBundle/Entity/Civility.php | 33 +-- src/Bundle/ChillMainBundle/Entity/Country.php | 24 +- .../Entity/CronJobExecution.php | 32 +-- .../Entity/DashboardConfigItem.php | 35 +-- .../Entity/Embeddable/CommentEmbeddable.php | 15 +- .../Embeddable/PrivateCommentEmbeddable.php | 7 +- .../Entity/GeographicalUnit.php | 39 +-- .../Entity/GeographicalUnitLayer.php | 34 +-- .../ChillMainBundle/Entity/GroupCenter.php | 49 ++-- .../ChillMainBundle/Entity/Language.php | 18 +- .../ChillMainBundle/Entity/Location.php | 73 ++---- .../ChillMainBundle/Entity/LocationType.php | 46 ++-- .../ChillMainBundle/Entity/NewsItem.php | 35 +-- .../ChillMainBundle/Entity/Notification.php | 88 +++---- .../Entity/NotificationComment.php | 65 ++--- .../Entity/PermissionsGroup.php | 42 +--- .../ChillMainBundle/Entity/PostalCode.php | 70 ++---- .../ChillMainBundle/Entity/Regroupment.php | 34 +-- .../ChillMainBundle/Entity/RoleScope.php | 44 ++-- .../ChillMainBundle/Entity/SavedExport.php | 39 +-- src/Bundle/ChillMainBundle/Entity/Scope.php | 34 +-- src/Bundle/ChillMainBundle/Entity/User.php | 100 +++----- .../Entity/User/UserJobHistory.php | 35 +-- .../Entity/User/UserScopeHistory.php | 35 +-- src/Bundle/ChillMainBundle/Entity/UserJob.php | 25 +- .../Entity/Workflow/EntityWorkflow.php | 42 ++-- .../Entity/Workflow/EntityWorkflowComment.php | 27 +-- .../Entity/Workflow/EntityWorkflowStep.php | 79 ++---- .../Tests/Export/SortExportElementTest.php | 2 +- .../Entity/AccompanyingPeriod.php | 203 +++++----------- .../AccompanyingPeriodInfo.php | 27 +-- .../AccompanyingPeriodLocationHistory.php | 39 +-- .../AccompanyingPeriodStepHistory.php | 43 ++-- .../AccompanyingPeriodWork.php | 119 +++------ .../AccompanyingPeriodWorkEvaluation.php | 84 ++----- ...companyingPeriodWorkEvaluationDocument.php | 39 +-- .../AccompanyingPeriodWorkGoal.php | 35 +-- .../AccompanyingPeriodWorkReferrerHistory.php | 33 +-- .../AccompanyingPeriod/ClosingMotive.php | 41 +--- .../Entity/AccompanyingPeriod/Comment.php | 57 ++--- .../Entity/AccompanyingPeriod/Origin.php | 26 +- .../Entity/AccompanyingPeriod/Resource.php | 60 ++--- .../Entity/AccompanyingPeriod/UserHistory.php | 43 ++-- .../AccompanyingPeriodParticipation.php | 39 +-- .../Entity/Household/Household.php | 52 ++-- .../Entity/Household/HouseholdComposition.php | 53 ++-- .../Household/HouseholdCompositionType.php | 28 +-- .../Entity/Household/HouseholdMember.php | 56 ++--- .../Household/PersonHouseholdAddress.php | 45 ++-- .../Entity/Household/Position.php | 34 +-- .../Entity/MaritalStatus.php | 18 +- .../ChillPersonBundle/Entity/Person.php | 228 +++++------------- .../Entity/Person/PersonCenterCurrent.php | 28 +-- .../Entity/Person/PersonCenterHistory.php | 31 +-- .../Entity/Person/PersonCurrentAddress.php | 27 +-- .../Entity/Person/PersonResource.php | 51 ++-- .../Entity/Person/PersonResourceKind.php | 26 +- .../Entity/Person/ResidentialAddress.php | 59 ++--- .../Entity/PersonAltName.php | 30 +-- .../Entity/PersonNotDuplicate.php | 26 +- .../ChillPersonBundle/Entity/PersonPhone.php | 45 +--- .../Entity/Relationships/Relation.php | 29 +-- .../Entity/Relationships/Relationship.php | 65 ++--- .../Entity/SocialWork/Evaluation.php | 44 +--- .../Entity/SocialWork/Goal.php | 33 +-- .../Entity/SocialWork/Result.php | 38 +-- .../Entity/SocialWork/SocialAction.php | 58 ++--- .../Entity/SocialWork/SocialIssue.php | 41 +--- .../ByStepAggregatorTest.php | 2 +- .../ByStepFilterTest.php | 2 +- .../ChillReportBundle/Entity/Report.php | 42 +--- .../ChillTaskBundle/Entity/AbstractTask.php | 47 +--- .../ChillTaskBundle/Entity/RecurringTask.php | 41 +--- .../ChillTaskBundle/Entity/SingleTask.php | 64 ++--- .../Entity/Task/AbstractTaskPlaceEvent.php | 22 +- .../Entity/Task/SingleTaskPlaceEvent.php | 40 +-- .../Entity/ThirdParty.php | 121 +++------- .../Entity/ThirdPartyCategory.php | 27 +-- .../Entity/ThirdPartyProfession.php | 27 +-- 124 files changed, 1724 insertions(+), 3770 deletions(-) diff --git a/rector.php b/rector.php index ec3020ddf..b5d6ad6ef 100644 --- a/rector.php +++ b/rector.php @@ -42,6 +42,7 @@ return static function (RectorConfig $rectorConfig): void { \Rector\Symfony\Set\SymfonySetList::SYMFONY_53, \Rector\Symfony\Set\SymfonySetList::SYMFONY_54, \Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_CODE_QUALITY, + \Rector\Doctrine\Set\DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES, ]); // migrate for phpunit diff --git a/src/Bundle/ChillActivityBundle/Entity/Activity.php b/src/Bundle/ChillActivityBundle/Entity/Activity.php index ec1ae23e2..bac5df2e0 100644 --- a/src/Bundle/ChillActivityBundle/Entity/Activity.php +++ b/src/Bundle/ChillActivityBundle/Entity/Activity.php @@ -44,11 +44,8 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class Activity. * - * @ORM\Entity(repositoryClass="Chill\ActivityBundle\Repository\ActivityRepository") * - * @ORM\Table(name="activity") * - * @ORM\HasLifecycleCallbacks * * @ActivityValidator\ActivityValidity * @@ -59,6 +56,9 @@ use Symfony\Component\Validator\Constraints as Assert; * path="scope") */ #[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 { use TrackCreationTrait; @@ -69,157 +69,121 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac final public const SENTRECEIVED_SENT = 'sent'; - /** - * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod") - */ #[Groups(['read'])] + #[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod::class)] private ?AccompanyingPeriod $accompanyingPeriod = null; - /** - * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType") - * - * @ORM\JoinColumn(name="type_id") - */ + #[Groups(['read', 'docgen:read'])] #[SerializedName('activityType')] + #[ORM\ManyToOne(targetEntity: \Chill\ActivityBundle\Entity\ActivityType::class)] + #[ORM\JoinColumn(name: 'type_id')] private ActivityType $activityType; - /** - * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence") - */ #[Groups(['docgen:read'])] + #[ORM\ManyToOne(targetEntity: \Chill\ActivityBundle\Entity\ActivityPresence::class)] private ?ActivityPresence $attendee = null; - /** - * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_") - */ #[Groups(['docgen:read'])] + #[ORM\Embedded(class: \Chill\MainBundle\Entity\Embeddable\CommentEmbeddable::class, columnPrefix: 'comment_')] private CommentEmbeddable $comment; - /** - * @ORM\Column(type="datetime") - */ #[Groups(['docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)] private \DateTime $date; /** - * @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject", cascade={"persist"}) - * * @var Collection */ #[Assert\Valid(traverse: true)] + #[ORM\ManyToMany(targetEntity: \Chill\DocStoreBundle\Entity\StoredObject::class, cascade: ['persist'])] private Collection $documents; - /** - * @ORM\Column(type="time", nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TIME_MUTABLE, nullable: true)] private ?\DateTime $durationTime = null; - /** - * @ORM\Column(type="boolean", options={"default": false}) - */ #[Groups(['docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])] private bool $emergency = false; - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - */ + #[Groups(['read', 'docgen:read'])] + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location") - */ #[Groups(['read', 'docgen:read'])] + #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Location::class)] private ?Location $location = null; - /** - * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person") - */ + #[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\Person::class)] private ?Person $person = null; /** - * @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person") - * * @var Collection */ #[Groups(['read', 'docgen:read'])] + #[ORM\ManyToMany(targetEntity: \Chill\PersonBundle\Entity\Person::class)] private Collection $persons; - /** - * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_") - */ + #[ORM\Embedded(class: \Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable::class, columnPrefix: 'privateComment_')] private PrivateCommentEmbeddable $privateComment; /** - * @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason") - * * @var Collection */ #[Groups(['docgen:read'])] + #[ORM\ManyToMany(targetEntity: \Chill\ActivityBundle\Entity\ActivityReason::class)] private Collection $reasons; - /** - * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope") - */ #[Groups(['docgen:read'])] + #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Scope::class)] private ?Scope $scope = null; - /** - * @ORM\Column(type="string", options={"default": ""}) - */ #[Groups(['docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, options: ['default' => ''])] private string $sentReceived = ''; /** - * @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction") * - * @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction") * * @var Collection */ #[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; /** - * @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue") * - * @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue") * * @var Collection */ #[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; /** - * @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty") - * * @var Collection */ #[Groups(['read', 'docgen:read'])] + #[ORM\ManyToMany(targetEntity: \Chill\ThirdPartyBundle\Entity\ThirdParty::class)] private Collection $thirdParties; - /** - * @ORM\Column(type="time", nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TIME_MUTABLE, nullable: true)] private ?\DateTime $travelTime = null; - /** - * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") - */ #[Groups(['docgen:read'])] + #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)] private ?User $user = null; /** - * @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User") - * * @var Collection */ #[Groups(['read', 'docgen:read'])] + #[ORM\ManyToMany(targetEntity: \Chill\MainBundle\Entity\User::class)] private Collection $users; public function __construct() diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php b/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php index 0a558c51b..e89158abd 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php @@ -17,35 +17,29 @@ use Symfony\Component\Serializer\Annotation as Serializer; /** * Class ActivityPresence. * - * @ORM\Entity * - * @ORM\Table(name="activitytpresence") * - * @ORM\HasLifecycleCallbacks */ +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'activitytpresence')] class ActivityPresence { - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $active = true; - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - */ + #[Serializer\Groups(['docgen:read'])] + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; /** - * @ORM\Column(type="json") - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ #[Serializer\Groups(['docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private array $name = []; /** diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php b/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php index 90d088f6f..6219acb9e 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php @@ -16,38 +16,27 @@ use Doctrine\ORM\Mapping as ORM; /** * Class ActivityReason. * - * @ORM\Entity * - * @ORM\Table(name="activityreason") * - * @ORM\HasLifecycleCallbacks */ +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'activityreason')] class ActivityReason { - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $active = true; - /** - * @ORM\ManyToOne( - * targetEntity="Chill\ActivityBundle\Entity\ActivityReasonCategory", - * inversedBy="reasons") - */ + #[ORM\ManyToOne(targetEntity: \Chill\ActivityBundle\Entity\ActivityReasonCategory::class, inversedBy: 'reasons')] private ?ActivityReasonCategory $category = null; - /** - * @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; - /** - * @ORM\Column(type="json") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private array $name; /** diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php b/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php index 64d7f9672..bd0cecf5a 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php @@ -18,44 +18,35 @@ use Doctrine\ORM\Mapping as ORM; /** * Class ActivityReasonCategory. * - * @ORM\Entity * - * @ORM\Table(name="activityreasoncategory") * - * @ORM\HasLifecycleCallbacks */ +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'activityreasoncategory')] class ActivityReasonCategory implements \Stringable { - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $active = true; - /** - * @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; /** * @var string - * - * @ORM\Column(type="json") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private $name; /** * Array of ActivityReason. * * @var Collection - * - * @ORM\OneToMany( - * targetEntity="Chill\ActivityBundle\Entity\ActivityReason", - * mappedBy="category") */ + #[ORM\OneToMany(targetEntity: \Chill\ActivityBundle\Entity\ActivityReason::class, mappedBy: 'category')] private Collection $reasons; /** diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php index 404cda36c..fd9a38c95 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php @@ -20,12 +20,12 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; /** * Class ActivityType. * - * @ORM\Entity * - * @ORM\Table(name="activitytype") * - * @ORM\HasLifecycleCallbacks */ +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'activitytype')] class ActivityType { final public const FIELD_INVISIBLE = 0; @@ -36,247 +36,161 @@ class ActivityType /** * @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 = ''; /** * @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; - /** - * @ORM\Column(type="boolean") - */ #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $active = true; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $attendeeLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $attendeeVisible = self::FIELD_OPTIONAL; - /** - * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityTypeCategory") - */ + #[ORM\ManyToOne(targetEntity: \Chill\ActivityBundle\Entity\ActivityTypeCategory::class)] private ?ActivityTypeCategory $category = null; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $commentLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $commentVisible = self::FIELD_OPTIONAL; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $dateLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 2}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 2])] private int $dateVisible = self::FIELD_REQUIRED; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $documentsLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $documentsVisible = self::FIELD_OPTIONAL; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $durationTimeLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $durationTimeVisible = self::FIELD_OPTIONAL; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $emergencyLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $emergencyVisible = self::FIELD_INVISIBLE; - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - */ + #[Groups(['docgen:read'])] + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $locationLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $locationVisible = self::FIELD_INVISIBLE; /** - * @ORM\Column(type="json") - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ #[Groups(['read', 'docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private array $name = []; - /** - * @ORM\Column(type="float", options={"default": "0.0"}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, options: ['default' => '0.0'])] private float $ordering = 0.0; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $personLabel = ''; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $personsLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $personsVisible = self::FIELD_OPTIONAL; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 2}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 2])] private int $personVisible = self::FIELD_REQUIRED; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $privateCommentLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $privateCommentVisible = self::FIELD_OPTIONAL; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $reasonsLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $reasonsVisible = self::FIELD_OPTIONAL; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $sentReceivedLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $sentReceivedVisible = self::FIELD_OPTIONAL; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $socialActionsLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $socialActionsVisible = self::FIELD_INVISIBLE; /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - * * @deprecated not in use */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $socialDataLabel = ''; /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - * * @deprecated not in use */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $socialDataVisible = self::FIELD_INVISIBLE; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $socialIssuesLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $socialIssuesVisible = self::FIELD_INVISIBLE; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $thirdPartiesLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $thirdPartiesVisible = self::FIELD_INVISIBLE; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $travelTimeLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $travelTimeVisible = self::FIELD_OPTIONAL; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $userLabel = ''; - /** - * @ORM\Column(type="string", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])] private string $usersLabel = ''; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - */ #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])] private int $usersVisible = self::FIELD_OPTIONAL; - /** - * @ORM\Column(type="smallint", nullable=false, options={"default": 2}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 2])] private int $userVisible = self::FIELD_REQUIRED; #[Assert\Callback] diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityTypeCategory.php b/src/Bundle/ChillActivityBundle/Entity/ActivityTypeCategory.php index 680a15fa7..d70535bbf 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityTypeCategory.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityTypeCategory.php @@ -13,37 +13,25 @@ namespace Chill\ActivityBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity - * - * @ORM\Table(name="activitytypecategory") - * - * @ORM\HasLifecycleCallbacks - */ + +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'activitytypecategory')] class ActivityTypeCategory { - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $active = true; - /** - * @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; - /** - * @ORM\Column(type="json") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private array $name = []; - /** - * @ORM\Column(type="float", options={"default": "0.0"}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, options: ['default' => '0.0'])] private float $ordering = 0.0; /** diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php index 02da401bc..ee58f31b7 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php @@ -18,79 +18,54 @@ use Chill\MainBundle\Entity\Location; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Entity - * - * @ORM\Table(schema="chill_asideactivity") - */ + +#[ORM\Entity] +#[ORM\Table(schema: 'chill_asideactivity')] class AsideActivity implements TrackCreationInterface, TrackUpdateInterface { - /** - * @ORM\ManyToOne(targetEntity=User::class) - * - * @ORM\JoinColumn(nullable=false) - */ + #[Assert\NotBlank] + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(nullable: false)] private User $agent; - /** - * @ORM\Column(type="datetime") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)] private ?\DateTimeInterface $createdAt = null; - /** - * @ORM\ManyToOne(targetEntity=User::class) - * - * @ORM\JoinColumn(nullable=false) - */ + + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(nullable: false)] private User $createdBy; - /** - * @ORM\Column(type="datetime") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)] private ?\DateTimeInterface $date = null; - /** - * @ORM\Column(type="time", nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TIME_MUTABLE, nullable: true)] private ?\DateTimeInterface $duration = null; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity=Location::class) - * - * @ORM\JoinColumn(nullable=true) - */ + + #[ORM\ManyToOne(targetEntity: Location::class)] + #[ORM\JoinColumn(nullable: true)] private ?Location $location = null; - /** - * @ORM\Column(type="text", nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)] private ?string $note = null; - /** - * @ORM\ManyToOne(targetEntity=AsideActivityCategory::class, inversedBy="asideActivities") - * - * @ORM\JoinColumn(nullable=false) - */ + + #[ORM\ManyToOne(targetEntity: AsideActivityCategory::class, inversedBy: 'asideActivities')] + #[ORM\JoinColumn(nullable: false)] private ?AsideActivityCategory $type = null; - /** - * @ORM\Column(type="datetime", nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)] private ?\DateTimeInterface $updatedAt = null; - /** - * @ORM\ManyToOne(targetEntity=User::class) - */ + #[ORM\ManyToOne(targetEntity: User::class)] private User $updatedBy; public function getAgent(): ?User diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php index e5eb044d9..ebf09e59c 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php @@ -17,51 +17,37 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Context\ExecutionContextInterface; -/** - * @ORM\Entity - * - * @ORM\Table(schema="chill_asideactivity") - */ + +#[ORM\Entity] +#[ORM\Table(schema: 'chill_asideactivity')] class AsideActivityCategory { /** - * @ORM\OneToMany(targetEntity=AsideActivityCategory::class, mappedBy="parent") - * * @var Collection */ + #[ORM\OneToMany(targetEntity: AsideActivityCategory::class, mappedBy: 'parent')] private Collection $children; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private int $id; - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $isActive = true; private AsideActivityCategory $oldParent; - /** - * @ORM\Column(type="float", options={"default": 0.00}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, options: ['default' => '0.00'])] private float $ordering = 0.00; - /** - * @ORM\ManyToOne(targetEntity=AsideActivityCategory::class, inversedBy="children") - * - * @ORM\JoinColumn(nullable=true) - */ + + #[ORM\ManyToOne(targetEntity: AsideActivityCategory::class, inversedBy: 'children')] + #[ORM\JoinColumn(nullable: true)] private ?AsideActivityCategory $parent = null; - /** - * @ORM\Column(type="json", length=255) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255)] private array $title; public function __construct() diff --git a/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php b/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php index e57438f0f..a348a0d07 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php +++ b/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php @@ -20,52 +20,33 @@ use Symfony\Component\Validator\Constraints as Assert; /** * AbstractElement. - * - * @ORM\MappedSuperclass */ +#[ORM\MappedSuperclass] abstract class AbstractElement { - /** - * @ORM\Column(name="amount", type="decimal", precision=10, scale=2) - */ #[Assert\GreaterThan(value: 0)] #[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; - /** - * @ORM\Column(name="comment", type="text", nullable=true) - */ + #[ORM\Column(name: 'comment', type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)] 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")] + #[ORM\Column(name: 'endDate', type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)] private ?\DateTimeImmutable $endDate = null; - /** - * @ORM\ManyToOne( - * targetEntity="\Chill\PersonBundle\Entity\Household\Household" - * ) - */ + #[ORM\ManyToOne(targetEntity: Household::class)] private ?Household $household = null; - /** - * @ORM\ManyToOne( - * targetEntity="\Chill\PersonBundle\Entity\Person" - * ) - */ + #[ORM\ManyToOne(targetEntity: Person::class)] private ?Person $person = null; - /** - * @ORM\Column(name="startDate", type="datetime_immutable") - */ #[Assert\Date] + #[ORM\Column(name: 'startDate', type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)] private \DateTimeImmutable $startDate; - /** - * @ORM\Column(name="type", type="string", length=255) - */ + #[ORM\Column(name: 'type', type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] private string $type = ''; /* Getters and Setters */ diff --git a/src/Bundle/ChillBudgetBundle/Entity/Charge.php b/src/Bundle/ChillBudgetBundle/Entity/Charge.php index d6af5cc1e..5c78398b5 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/Charge.php +++ b/src/Bundle/ChillBudgetBundle/Entity/Charge.php @@ -18,10 +18,10 @@ use Doctrine\ORM\Mapping as ORM; /** * 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 { final public const HELP_ASKED = 'running'; @@ -39,25 +39,18 @@ class Charge extends AbstractElement implements HasCentersInterface self::HELP_NOT_RELEVANT, ]; - /** - * @ORM\ManyToOne(targetEntity=ChargeKind::class, inversedBy="AbstractElement") - * - * @ORM\JoinColumn - */ + + #[ORM\ManyToOne(targetEntity: ChargeKind::class, inversedBy: 'AbstractElement')] + #[ORM\JoinColumn] private ?ChargeKind $charge = null; - /** - * @ORM\Column(name="help", type="string", nullable=true) - */ + #[ORM\Column(name: 'help', type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)] private ?string $help = self::HELP_NOT_RELEVANT; - /** - * @ORM\Column(name="id", type="integer") - * - * @ORM\Id - * - * @ORM\GeneratedValue(strategy="AUTO") - */ + + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; public function __construct() diff --git a/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php b/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php index 4150d09cc..7d8037802 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php +++ b/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php @@ -18,49 +18,35 @@ use Symfony\Component\Validator\Constraints as Assert; /** * 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'])] +#[ORM\Entity] +#[ORM\Table(name: 'chill_budget.charge_type')] +#[ORM\UniqueConstraint(name: 'charge_kind_unique_type_idx', fields: ['kind'])] class ChargeKind { - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="boolean", options={"default": true}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => 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\Length(min: 3)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, options: ['default' => ''], nullable: false)] private string $kind = ''; - /** - * @ORM\Column(type="json", length=255, options={"default": "[]"}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '[]'])] private array $name = []; - /** - * @ORM\Column(type="float", options={"default": 0.00}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, options: ['default' => '0.00'])] private float $ordering = 0.00; - /** - * @ORM\Column(type="json", length=255, options={"default": "[]"}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '[]'])] private array $tags = []; public function getId(): ?int diff --git a/src/Bundle/ChillBudgetBundle/Entity/Resource.php b/src/Bundle/ChillBudgetBundle/Entity/Resource.php index c4845ed1b..c482424a8 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/Resource.php +++ b/src/Bundle/ChillBudgetBundle/Entity/Resource.php @@ -18,26 +18,21 @@ use Doctrine\ORM\Mapping as ORM; /** * 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 { - /** - * @ORM\Column(name="id", type="integer") - * - * @ORM\Id - * - * @ORM\GeneratedValue(strategy="AUTO") - */ + + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity=ResourceKind::class, inversedBy="AbstractElement") - * - * @ORM\JoinColumn - */ + + #[ORM\ManyToOne(targetEntity: ResourceKind::class, inversedBy: 'AbstractElement')] + #[ORM\JoinColumn] private ?ResourceKind $resource = null; public function __construct() diff --git a/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php b/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php index 2e0e360d9..30c1ac3d3 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php +++ b/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php @@ -18,52 +18,37 @@ use Symfony\Component\Validator\Constraints as Assert; /** * 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'])] +#[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 { - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="boolean", options={"default": true}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => 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\Length(min: 3)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: false, options: ['default' => ''])] private string $kind = ''; - /** - * @ORM\Column(type="json", length=255, options={"default": "[]"}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '[]'])] private array $name = []; - /** - * @ORM\Column(type="float", options={"default": 0.00}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, options: ['default' => '0.00'])] private float $ordering = 0.00; - /** - * @ORM\Column(type="json", length=255, options={"default": "[]"}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '[]'])] private array $tags = []; public function getId(): ?int diff --git a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php index 38a7e29f0..ee148820e 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php @@ -36,15 +36,11 @@ use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\Range; 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])] +#[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 { use RemoteCalendarTrait; @@ -86,105 +82,75 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente public ?User $previousMainUser = null; - /** - * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod", inversedBy="calendars") - */ #[Serializer\Groups(['calendar:read', 'read'])] + #[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod::class, inversedBy: 'calendars')] private ?AccompanyingPeriod $accompanyingPeriod = null; - /** - * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\Activity") - */ + #[ORM\ManyToOne(targetEntity: \Chill\ActivityBundle\Entity\Activity::class)] private ?Activity $activity = null; - /** - * @ORM\OneToOne(targetEntity="CalendarRange", inversedBy="calendar") - */ #[Serializer\Groups(['calendar:read', 'read'])] + #[ORM\OneToOne(targetEntity: \CalendarRange::class, inversedBy: 'calendar')] private ?CalendarRange $calendarRange = null; - /** - * @ORM\ManyToOne(targetEntity="CancelReason") - */ + #[ORM\ManyToOne(targetEntity: \CancelReason::class)] private ?CancelReason $cancelReason = null; - /** - * @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_") - */ #[Serializer\Groups(['calendar:read', 'read', 'docgen:read'])] + #[ORM\Embedded(class: CommentEmbeddable::class, columnPrefix: 'comment_')] private CommentEmbeddable $comment; - /** - * @ORM\Column(type="integer", nullable=false, options={"default": 0}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: false, options: ['default' => 0])] private int $dateTimeVersion = 0; /** * @var Collection - * - * @ORM\OneToMany(targetEntity=CalendarDoc::class, mappedBy="calendar", orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: CalendarDoc::class, mappedBy: 'calendar', orphanRemoval: true)] private Collection $documents; - /** - * @ORM\Column(type="datetime_immutable", nullable=false) - */ #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] #[Assert\NotNull(message: 'calendar.An end date is required')] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)] private ?\DateTimeImmutable $endDate = null; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + #[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; /** - * @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 */ #[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; - /** - * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location") - */ #[Serializer\Groups(['read', 'docgen:read'])] #[Assert\NotNull(message: 'calendar.A location is required')] + #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Location::class)] private ?Location $location = null; /** - * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") - * * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) */ #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] #[Assert\NotNull(message: 'calendar.A main user is mandatory')] + #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)] private ?User $mainUser = null; - /** - * @ORM\ManyToOne(targetEntity=Person::class) - * - * @ORM\JoinColumn(nullable=true) - */ + + #[ORM\ManyToOne(targetEntity: Person::class)] + #[ORM\JoinColumn(nullable: true)] 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"}) * @@ -192,58 +158,50 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente */ #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] #[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; - /** - * @ORM\Embedded(class=PrivateCommentEmbeddable::class, columnPrefix="privateComment_") - */ #[Serializer\Groups(['calendar:read'])] + #[ORM\Embedded(class: PrivateCommentEmbeddable::class, columnPrefix: 'privateComment_')] private PrivateCommentEmbeddable $privateComment; /** * @var Collection * - * @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty") * - * @ORM\JoinTable(name="chill_calendar.calendar_to_thirdparties") * * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) */ #[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; - /** - * @ORM\Column(type="boolean", nullable=true) - */ #[Serializer\Groups(['docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: true)] private ?bool $sendSMS = false; - /** - * @ORM\Column(type="text", nullable=false, options={"default": Calendar::SMS_PENDING}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => Calendar::SMS_PENDING])] private string $smsStatus = self::SMS_PENDING; /** - * @ORM\Column(type="datetime_immutable", nullable=false) - * * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) */ #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] #[Assert\NotNull(message: 'calendar.A start date is required')] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)] private ?\DateTimeImmutable $startDate = null; /** - * @ORM\Column(type="string", length=255, nullable=false, options={"default": "valid"}) - * * @Serializer\Context(normalizationContext={"read"}, groups={"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; - /** - * @ORM\Column(type="boolean", nullable=true) - */ #[Serializer\Groups(['docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: true)] private ?bool $urgent = false; public function __construct() diff --git a/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc.php b/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc.php index 5ea958fab..00493787b 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc.php +++ b/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc.php @@ -20,50 +20,35 @@ use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface; use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity - * - * @ORM\Table( - * name="chill_calendar.calendar_doc", - * ) - */ + +#[ORM\Entity] +#[ORM\Table(name: 'chill_calendar.calendar_doc')] class CalendarDoc implements TrackCreationInterface, TrackUpdateInterface { use TrackCreationTrait; use TrackUpdateTrait; - /** - * @ORM\ManyToOne(targetEntity=Calendar::class, inversedBy="documents") - * - * @ORM\JoinColumn(nullable=false) - */ + + #[ORM\ManyToOne(targetEntity: Calendar::class, inversedBy: 'documents')] + #[ORM\JoinColumn(nullable: false)] private Calendar $calendar; - /** - * @ORM\Column(type="integer", nullable=false, options={"default": 0}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: false, options: ['default' => 0])] private int $datetimeVersion = 0; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="boolean", nullable=false, options={"default": false}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: false, options: ['default' => false])] private bool $trackDateTimeVersion = false; - public function __construct(Calendar $calendar, /** - * @ORM\ManyToOne(targetEntity=StoredObject::class, cascade={"persist"}) - * - * @ORM\JoinColumn(nullable=false) - */ + public function __construct(Calendar $calendar, + #[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])] + #[ORM\JoinColumn(nullable: false)] private ?StoredObject $storedObject) { $this->setCalendar($calendar); diff --git a/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php b/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php index 3e2cf1eb0..633a5c1f8 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php +++ b/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php @@ -21,14 +21,10 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Table( - * name="chill_calendar.calendar_range", - * uniqueConstraints={@ORM\UniqueConstraint(name="idx_calendar_range_remote", columns={"remoteId"}, options={"where": "remoteId <> ''"})} - * ) - * - * @ORM\Entity - */ + +#[ORM\Entity] +#[ORM\Table(name: 'chill_calendar.calendar_range')] +#[ORM\UniqueConstraint(name: 'idx_calendar_range_remote', columns: ['remoteId'], options: ['where' => "remoteId <> ''"])] class CalendarRange implements TrackCreationInterface, TrackUpdateInterface { use RemoteCalendarTrait; @@ -37,49 +33,36 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface use TrackUpdateTrait; - /** - * @ORM\OneToOne(targetEntity=Calendar::class, mappedBy="calendarRange") - */ + #[ORM\OneToOne(targetEntity: Calendar::class, mappedBy: 'calendarRange')] private ?Calendar $calendar = null; - /** - * @ORM\Column(type="datetime_immutable", nullable=false) - */ #[Groups(['read', 'write', 'calendar:read'])] #[Assert\NotNull] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)] private ?\DateTimeImmutable $endDate = null; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + #[Groups(['read'])] + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity=Location::class) - * - * @ORM\JoinColumn(nullable=false) - */ + #[Groups(['read', 'write', 'calendar:read'])] #[Assert\NotNull] + #[ORM\ManyToOne(targetEntity: Location::class)] + #[ORM\JoinColumn(nullable: false)] private ?Location $location = null; - /** - * @ORM\Column(type="datetime_immutable", nullable=false) - */ #[Groups(['read', 'write', 'calendar:read'])] #[Assert\NotNull] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)] private ?\DateTimeImmutable $startDate = null; - /** - * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") - */ #[Groups(['read', 'write', 'calendar:read'])] #[Assert\NotNull] + #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)] private ?User $user = null; public function getCalendar(): ?Calendar diff --git a/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php b/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php index cff54e70b..75fb311fe 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php +++ b/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php @@ -14,11 +14,9 @@ namespace Chill\CalendarBundle\Entity; use Chill\CalendarBundle\Repository\CancelReasonRepository; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table(name="chill_calendar.cancel_reason") - * - * @ORM\Entity(repositoryClass=CancelReasonRepository::class) - */ + +#[ORM\Entity(repositoryClass: CancelReasonRepository::class)] +#[ORM\Table(name: 'chill_calendar.cancel_reason')] class CancelReason { final public const CANCELEDBY_DONOTCOUNT = 'CANCELEDBY_DONOTCOUNT'; @@ -27,28 +25,19 @@ class CancelReason final public const CANCELEDBY_USER = 'CANCELEDBY_USER'; - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private ?bool $active = null; - /** - * @ORM\Column(type="string", length=255) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] private ?string $canceledBy = null; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="json") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private array $name = []; public function getActive(): ?bool diff --git a/src/Bundle/ChillCalendarBundle/Entity/Invite.php b/src/Bundle/ChillCalendarBundle/Entity/Invite.php index 40024c52d..25da8fcd3 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Invite.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Invite.php @@ -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 * 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 { use RemoteCalendarTrait; @@ -58,33 +56,24 @@ class Invite implements TrackUpdateInterface, TrackCreationInterface final public const TENTATIVELY_ACCEPTED = 'tentative'; - /** - * @ORM\ManyToOne(targetEntity=Calendar::class, inversedBy="invites") - */ + #[ORM\ManyToOne(targetEntity: Calendar::class, inversedBy: 'invites')] private ?Calendar $calendar = null; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + #[Serializer\Groups(groups: ['calendar:read', 'read'])] + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="text", nullable=false, options={"default": "pending"}) - */ #[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; - /** - * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") - * - * @ORM\JoinColumn(nullable=false) - */ + #[Serializer\Groups(groups: ['calendar:read', 'read', 'docgen:read'])] + #[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)] + #[ORM\JoinColumn(nullable: false)] private ?User $user = null; public function getCalendar(): ?Calendar diff --git a/src/Bundle/ChillCalendarBundle/Entity/RemoteCalendarTrait.php b/src/Bundle/ChillCalendarBundle/Entity/RemoteCalendarTrait.php index 31282fb0b..b02875eed 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/RemoteCalendarTrait.php +++ b/src/Bundle/ChillCalendarBundle/Entity/RemoteCalendarTrait.php @@ -30,14 +30,10 @@ trait RemoteCalendarTrait */ public bool $preventEnqueueChanges = false; - /** - * @ORM\Column(type="json", options={"default": "[]"}, nullable=false) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '[]'], nullable: false)] private array $remoteAttributes = []; - /** - * @ORM\Column(type="text", options={"default": ""}, nullable=false) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => ''], nullable: false)] private string $remoteId = ''; public function addRemoteAttributes(array $remoteAttributes): self diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php index 6d1373fb0..fa60f6b91 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php @@ -16,69 +16,49 @@ use Doctrine\ORM\Mapping as ORM; /** * CustomField. * - * @ORM\Entity * - * @ORM\Table(name="customfield") * - * @ORM\HasLifecycleCallbacks */ +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'customfield')] class CustomField { final public const ONE_TO_MANY = 2; final public const ONE_TO_ONE = 1; - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $active = true; - /** - * @ORM\ManyToOne( - * targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldsGroup", - * inversedBy="customFields") - */ + #[ORM\ManyToOne(targetEntity: \Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class, inversedBy: 'customFields')] private ?CustomFieldsGroup $customFieldGroup = null; - /** - * @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; /** * @var array - * - * @ORM\Column(type="json") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private $name; - /** - * @ORM\Column(type="json") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private array $options = []; - /** - * @ORM\Column(type="float") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)] private ?float $ordering = null; - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private false $required = false; - /** - * @ORM\Column(type="string", length=255) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] private ?string $slug = null; - /** - * @ORM\Column(type="string", length=255) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] private ?string $type = null; /** diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php index 2d9889066..8afd96f81 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php @@ -15,61 +15,41 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity( - * repositoryClass="Chill\CustomFieldsBundle\EntityRepository\CustomFieldLongChoice\OptionRepository") - * - * @ORM\Table(name="custom_field_long_choice_options") - */ + +#[ORM\Entity(repositoryClass: \Chill\CustomFieldsBundle\EntityRepository\CustomFieldLongChoice\OptionRepository::class)] +#[ORM\Table(name: 'custom_field_long_choice_options')] class Option { - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $active = true; /** * @var Collection