mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
Add / Edit / Delete activity from Accompanying Course
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user