Feature: an activity has the same scope as an accompanying period, if it exists

This commit is contained in:
2022-07-11 17:36:59 +02:00
parent 3785e5096e
commit 93560a62ef
2 changed files with 16 additions and 3 deletions

View File

@@ -17,7 +17,7 @@ use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable;
use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\MainBundle\Entity\HasScopeInterface;
use Chill\MainBundle\Entity\HasScopesInterface;
use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User;
@@ -55,7 +55,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* getUserFunction="getUser",
* path="scope")
*/
class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, HasCenterInterface, HasScopeInterface
class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, HasCenterInterface, HasScopesInterface
{
public const SENTRECEIVED_RECEIVED = 'received';
@@ -422,6 +422,19 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
return $this->scope;
}
public function getScopes(): array
{
if (null !== $this->getAccompanyingPeriod()) {
return $this->getAccompanyingPeriod()->getScopes();
}
if (null !== $this->getPerson()) {
return [$this->scope];
}
return [];
}
public function getSentReceived(): string
{
return $this->sentReceived;