mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 18:43:49 +00:00
Event: add more fields: documents, organizationCost, note, and location
This commit is contained in:
@@ -11,13 +11,16 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\EventBundle\Entity;
|
||||
|
||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||
use Chill\MainBundle\Entity\HasCenterInterface;
|
||||
use Chill\MainBundle\Entity\HasScopeInterface;
|
||||
use Chill\MainBundle\Entity\Location;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use DateTime;
|
||||
@@ -42,6 +45,7 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center")A
|
||||
*
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
private ?Center $center = null;
|
||||
@@ -72,6 +76,7 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=150)
|
||||
*
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
private ?string $name = null;
|
||||
@@ -87,16 +92,45 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\EventType")
|
||||
*
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
private ?EventType $type = null;
|
||||
|
||||
/**
|
||||
* @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_")
|
||||
*/
|
||||
private CommentEmbeddable $comment;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Location::class)
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*/
|
||||
private ?Location $location = null;
|
||||
|
||||
/**
|
||||
* @var Collection<StoredObject>
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity=StoredObject::class, cascade={"persist","refresh"})
|
||||
*
|
||||
* @ORM\JoinTable("chill_event_event_documents")
|
||||
*/
|
||||
private Collection $documents;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="decimal", precision=10, scale=4, nullable=true, options={"default": null})
|
||||
*/
|
||||
private string $organizationCost = '0.0';
|
||||
|
||||
/**
|
||||
* Event constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->participations = new ArrayCollection();
|
||||
$this->documents = new ArrayCollection();
|
||||
$this->comment = new CommentEmbeddable();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,6 +145,22 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addDocument(StoredObject $storedObject): self
|
||||
{
|
||||
if ($this->documents->contains($storedObject)) {
|
||||
$this->documents[] = $storedObject;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeDocument(StoredObject $storedObject): self
|
||||
{
|
||||
$this->documents->removeElement($storedObject);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Center
|
||||
*/
|
||||
@@ -270,4 +320,44 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getComment(): CommentEmbeddable
|
||||
{
|
||||
return $this->comment;
|
||||
}
|
||||
|
||||
public function setComment(CommentEmbeddable $comment): void
|
||||
{
|
||||
$this->comment = $comment;
|
||||
}
|
||||
|
||||
public function getLocation(): ?Location
|
||||
{
|
||||
return $this->location;
|
||||
}
|
||||
|
||||
public function setLocation(?Location $location): void
|
||||
{
|
||||
$this->location = $location;
|
||||
}
|
||||
|
||||
public function getDocuments(): Collection
|
||||
{
|
||||
return $this->documents;
|
||||
}
|
||||
|
||||
public function setDocuments(Collection $documents): void
|
||||
{
|
||||
$this->documents = $documents;
|
||||
}
|
||||
|
||||
public function getOrganizationCost(): string
|
||||
{
|
||||
return $this->organizationCost;
|
||||
}
|
||||
|
||||
public function setOrganizationCost(string $organizationCost): void
|
||||
{
|
||||
$this->organizationCost = $organizationCost;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user