Add / Edit / Delete activity from Accompanying Course

This commit is contained in:
Jean-Francois Monfort
2021-05-20 15:56:34 +02:00
parent c59cf3f0df
commit 8fe00b4c2b
24 changed files with 795 additions and 433 deletions

View File

@@ -22,6 +22,7 @@ namespace Chill\ActivityBundle\Entity;
use Chill\DocStoreBundle\Entity\Document;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Doctrine\ORM\Mapping as ORM;
use Chill\MainBundle\Entity\Scope;
@@ -41,11 +42,16 @@ use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency;
* @ORM\Entity()
* @ORM\Table(name="activity")
* @ORM\HasLifecycleCallbacks()
*/
/*
* TODO : revoir
* @UserCircleConsistency(
* "CHILL_ACTIVITY_SEE_DETAILS",
* getUserFunction="getUser",
* path="scope")
*/
class Activity implements HasCenterInterface, HasScopeInterface
{
const SENTRECEIVED_SENT = 'sent';
@@ -101,7 +107,12 @@ class Activity implements HasCenterInterface, HasScopeInterface
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
*/
private Person $person;
private ?Person $person = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod")
*/
private ?AccompanyingPeriod $accompanyingPeriod = null;
/**
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
@@ -261,25 +272,41 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this->scope;
}
public function setPerson(Person $person): self
public function setPerson(?Person $person): self
{
$this->person = $person;
return $this;
}
public function getPerson(): Person
public function getPerson(): ?Person
{
return $this->person;
}
public function getAccompanyingPeriod(): ?AccompanyingPeriod
{
return $this->accompanyingPeriod;
}
public function setAccompanyingPeriod(?AccompanyingPeriod $accompanyingPeriod): self
{
$this->accompanyingPeriod = $accompanyingPeriod;
return $this;
}
/**
* get the center
* center is extracted from person
*/
public function getCenter(): Center
public function getCenter(): ?Center
{
return $this->person->getCenter();
if ($this->person instanceof Person) {
return $this->person->getCenter();
}
return null;
}
public function getComment(): CommentEmbeddable
@@ -422,4 +449,3 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this;
}
}