Apply rector rules: add annotation for doctrine mapping

This commit is contained in:
2024-04-05 13:11:42 +02:00
parent a3f775a69b
commit 0ff4593863
118 changed files with 143 additions and 658 deletions

View File

@@ -32,7 +32,6 @@ use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
@@ -44,9 +43,6 @@ use Symfony\Component\Validator\Constraints as Assert;
/**
* Class Activity.
*
*
*
*
* @ActivityValidator\ActivityValidity
*
* TODO see if necessary
@@ -70,22 +66,21 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
final public const SENTRECEIVED_SENT = 'sent';
#[Groups(['read'])]
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod::class)]
#[ORM\ManyToOne(targetEntity: AccompanyingPeriod::class)]
private ?AccompanyingPeriod $accompanyingPeriod = null;
#[Groups(['read', 'docgen:read'])]
#[SerializedName('activityType')]
#[ORM\ManyToOne(targetEntity: \Chill\ActivityBundle\Entity\ActivityType::class)]
#[ORM\ManyToOne(targetEntity: ActivityType::class)]
#[ORM\JoinColumn(name: 'type_id')]
private ActivityType $activityType;
#[Groups(['docgen:read'])]
#[ORM\ManyToOne(targetEntity: \Chill\ActivityBundle\Entity\ActivityPresence::class)]
#[ORM\ManyToOne(targetEntity: ActivityPresence::class)]
private ?ActivityPresence $attendee = null;
#[Groups(['docgen:read'])]
#[ORM\Embedded(class: \Chill\MainBundle\Entity\Embeddable\CommentEmbeddable::class, columnPrefix: 'comment_')]
#[ORM\Embedded(class: CommentEmbeddable::class, columnPrefix: 'comment_')]
private CommentEmbeddable $comment;
#[Groups(['docgen:read'])]
@@ -96,7 +91,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
* @var Collection<StoredObject>
*/
#[Assert\Valid(traverse: true)]
#[ORM\ManyToMany(targetEntity: \Chill\DocStoreBundle\Entity\StoredObject::class, cascade: ['persist'])]
#[ORM\ManyToMany(targetEntity: StoredObject::class, cascade: ['persist'])]
private Collection $documents;
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TIME_MUTABLE, nullable: true)]
@@ -106,7 +101,6 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
private bool $emergency = false;
#[Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
@@ -114,31 +108,31 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
private ?int $id = null;
#[Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Location::class)]
#[ORM\ManyToOne(targetEntity: Location::class)]
private ?Location $location = null;
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\Person::class)]
#[ORM\ManyToOne(targetEntity: Person::class)]
private ?Person $person = null;
/**
* @var Collection<Person>
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\ManyToMany(targetEntity: \Chill\PersonBundle\Entity\Person::class)]
#[ORM\ManyToMany(targetEntity: Person::class)]
private Collection $persons;
#[ORM\Embedded(class: \Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable::class, columnPrefix: 'privateComment_')]
#[ORM\Embedded(class: PrivateCommentEmbeddable::class, columnPrefix: 'privateComment_')]
private PrivateCommentEmbeddable $privateComment;
/**
* @var Collection<ActivityReason>
*/
#[Groups(['docgen:read'])]
#[ORM\ManyToMany(targetEntity: \Chill\ActivityBundle\Entity\ActivityReason::class)]
#[ORM\ManyToMany(targetEntity: ActivityReason::class)]
private Collection $reasons;
#[Groups(['docgen:read'])]
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Scope::class)]
#[ORM\ManyToOne(targetEntity: Scope::class)]
private ?Scope $scope = null;
#[Groups(['docgen:read'])]
@@ -146,22 +140,18 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
private string $sentReceived = '';
/**
*
*
* @var Collection<SocialAction>
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\ManyToMany(targetEntity: \Chill\PersonBundle\Entity\SocialWork\SocialAction::class)]
#[ORM\ManyToMany(targetEntity: SocialAction::class)]
#[ORM\JoinTable(name: 'chill_activity_activity_chill_person_socialaction')]
private Collection $socialActions;
/**
*
*
* @var Collection<SocialIssue>
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\ManyToMany(targetEntity: \Chill\PersonBundle\Entity\SocialWork\SocialIssue::class)]
#[ORM\ManyToMany(targetEntity: SocialIssue::class)]
#[ORM\JoinTable(name: 'chill_activity_activity_chill_person_socialissue')]
private Collection $socialIssues;
@@ -169,21 +159,21 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
* @var Collection<ThirdParty>
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\ManyToMany(targetEntity: \Chill\ThirdPartyBundle\Entity\ThirdParty::class)]
#[ORM\ManyToMany(targetEntity: ThirdParty::class)]
private Collection $thirdParties;
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TIME_MUTABLE, nullable: true)]
private ?\DateTime $travelTime = null;
#[Groups(['docgen:read'])]
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)]
#[ORM\ManyToOne(targetEntity: User::class)]
private ?User $user = null;
/**
* @var Collection<User>
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\ManyToMany(targetEntity: \Chill\MainBundle\Entity\User::class)]
#[ORM\ManyToMany(targetEntity: User::class)]
private Collection $users;
public function __construct()

View File

@@ -16,9 +16,6 @@ use Symfony\Component\Serializer\Annotation as Serializer;
/**
* Class ActivityPresence.
*
*
*
*/
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
@@ -28,18 +25,15 @@ class ActivityPresence
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $active = true;
#[Serializer\Groups(['docgen:read'])]
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null;
/**
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
#[Serializer\Context(['is-translatable' => true], groups: ['docgen:read'])]
private array $name = [];
/**

View File

@@ -15,9 +15,6 @@ use Doctrine\ORM\Mapping as ORM;
/**
* Class ActivityReason.
*
*
*
*/
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
@@ -27,10 +24,9 @@ class ActivityReason
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $active = true;
#[ORM\ManyToOne(targetEntity: \Chill\ActivityBundle\Entity\ActivityReasonCategory::class, inversedBy: 'reasons')]
#[ORM\ManyToOne(targetEntity: ActivityReasonCategory::class, inversedBy: 'reasons')]
private ?ActivityReasonCategory $category = null;
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]

View File

@@ -17,9 +17,6 @@ use Doctrine\ORM\Mapping as ORM;
/**
* Class ActivityReasonCategory.
*
*
*
*/
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
@@ -29,7 +26,6 @@ class ActivityReasonCategory implements \Stringable
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $active = true;
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
@@ -46,7 +42,7 @@ class ActivityReasonCategory implements \Stringable
*
* @var Collection<ActivityReason>
*/
#[ORM\OneToMany(targetEntity: \Chill\ActivityBundle\Entity\ActivityReason::class, mappedBy: 'category')]
#[ORM\OneToMany(targetEntity: ActivityReason::class, mappedBy: 'category')]
private Collection $reasons;
/**

View File

@@ -19,9 +19,6 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* Class ActivityType.
*
*
*
*/
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
@@ -56,7 +53,7 @@ class ActivityType
#[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::class)]
#[ORM\ManyToOne(targetEntity: ActivityTypeCategory::class)]
private ?ActivityTypeCategory $category = null;
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: false, options: ['default' => ''])]
@@ -89,7 +86,6 @@ class ActivityType
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])]
private int $emergencyVisible = self::FIELD_INVISIBLE;
#[Groups(['docgen:read'])]
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
@@ -102,11 +98,9 @@ class ActivityType
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::SMALLINT, nullable: false, options: ['default' => 1])]
private int $locationVisible = self::FIELD_INVISIBLE;
/**
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
#[Serializer\Context(['is-translatable' => true], groups: ['docgen:read'])]
private array $name = [];
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, options: ['default' => '0.0'])]

View File

@@ -13,7 +13,6 @@ namespace Chill\ActivityBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'activitytypecategory')]
@@ -22,7 +21,6 @@ class ActivityTypeCategory
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $active = true;
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]