activity: change name of property type in activityType to allow property 'type' in the serializer (by DiscriminatorMap)

This commit is contained in:
nobohan 2021-11-19 14:12:41 +01:00
parent 4645244975
commit 3ce3613c71

View File

@ -31,7 +31,7 @@ use Symfony\Component\Serializer\Annotation\SerializedName;
* @ORM\Entity(repositoryClass="Chill\ActivityBundle\Repository\ActivityRepository") * @ORM\Entity(repositoryClass="Chill\ActivityBundle\Repository\ActivityRepository")
* @ORM\Table(name="activity") * @ORM\Table(name="activity")
* @ORM\HasLifecycleCallbacks() * @ORM\HasLifecycleCallbacks()
* @DiscriminatorMap(typeProperty="_type", mapping={ * @DiscriminatorMap(typeProperty="type", mapping={
* "activity"=Activity::class * "activity"=Activity::class
* }) * })
*/ */
@ -105,8 +105,9 @@ class Activity implements HasCenterInterface, HasScopeInterface, AccompanyingPer
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType") * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
* @Groups({"read"}) * @Groups({"read"})
* @SerializedName("activityType") * @SerializedName("activityType")
* @ORM\JoinColumn(name="type_id")
*/ */
private ActivityType $type; private ActivityType $activityType;
/** /**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope") * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
@ -312,19 +313,34 @@ class Activity implements HasCenterInterface, HasScopeInterface, AccompanyingPer
return $this; return $this;
} }
public function setActivityType(ActivityType $activityType): self
public function setType(ActivityType $type): self
{ {
$this->type = $type; $this->activityType = $activityType;
return $this; 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 public function getType(): ActivityType
{ {
return $this->type; return $this->activityType;
} }
public function setScope(Scope $scope): self public function setScope(Scope $scope): self