From 3ce3613c711b11979704e0b6189cf9fd937691ce Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 19 Nov 2021 14:12:41 +0100 Subject: [PATCH] activity: change name of property type in activityType to allow property 'type' in the serializer (by DiscriminatorMap) --- .../ChillActivityBundle/Entity/Activity.php | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Entity/Activity.php b/src/Bundle/ChillActivityBundle/Entity/Activity.php index 995cf450d..48d165874 100644 --- a/src/Bundle/ChillActivityBundle/Entity/Activity.php +++ b/src/Bundle/ChillActivityBundle/Entity/Activity.php @@ -31,7 +31,7 @@ use Symfony\Component\Serializer\Annotation\SerializedName; * @ORM\Entity(repositoryClass="Chill\ActivityBundle\Repository\ActivityRepository") * @ORM\Table(name="activity") * @ORM\HasLifecycleCallbacks() - * @DiscriminatorMap(typeProperty="_type", mapping={ + * @DiscriminatorMap(typeProperty="type", mapping={ * "activity"=Activity::class * }) */ @@ -105,8 +105,9 @@ class Activity implements HasCenterInterface, HasScopeInterface, AccompanyingPer * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType") * @Groups({"read"}) * @SerializedName("activityType") + * @ORM\JoinColumn(name="type_id") */ - private ActivityType $type; + private ActivityType $activityType; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope") @@ -312,19 +313,34 @@ class Activity implements HasCenterInterface, HasScopeInterface, AccompanyingPer return $this; } - - - - public function setType(ActivityType $type): self + public function setActivityType(ActivityType $activityType): self { - $this->type = $type; + $this->activityType = $activityType; return $this; } + public function getActivityType(): ActivityType + { + return $this->activityType; + } + + /** + * @deprecated + */ + public function setType(ActivityType $activityType): self + { + $this->activityType = $activityType; + + return $this; + } + + /** + * @deprecated + */ public function getType(): ActivityType { - return $this->type; + return $this->activityType; } public function setScope(Scope $scope): self