/** * @JMS\VirtualProperty * @JMS\SerializedName("actualRole") * @JMS\Groups({"finished"}) * * @return Role | null */ public function getActualRole() { if (!$this->game->hasFinished()) { return null; } if ($this->swapDestination !== null) { return $this->swapDestination->getRole(); } if (!$this->swapSources->isEmpty()) { return $this->swapSources->first()->getRole(); } return $this->role; }