Add animators property to event

This commit is contained in:
2025-05-07 10:26:39 +02:00
parent 342b786106
commit 6713658569
7 changed files with 116 additions and 49 deletions

View File

@@ -23,6 +23,7 @@ use Chill\MainBundle\Entity\HasScopeInterface;
use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
@@ -48,20 +49,28 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
#[ORM\ManyToOne(targetEntity: Scope::class)]
private ?Scope $circle = null;
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)]
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTime $date = null;
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\Column(name: 'id', type: Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null;
#[ORM\ManyToOne(targetEntity: User::class)]
private ?User $moderator = null;
/**
* @var Collection<int, ThirdParty>
*/
#[ORM\ManyToMany(targetEntity: ThirdParty::class)]
#[Serializer\Groups(['read'])]
#[ORM\JoinTable('chill_event_thirdparty')]
private Collection $animators;
#[Assert\NotBlank]
#[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 150)]
#[ORM\Column(type: Types::STRING, length: 150)]
private ?string $name = null;
/**
@@ -99,9 +108,6 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
#[ORM\JoinTable('chill_event_event_documents')]
private Collection $documents;
#[ORM\Column(type: Types::DECIMAL, precision: 10, scale: 4, nullable: true, options: ['default' => '0.0'])]
private string $organizationCost = '0.0';
/**
* @var Collection<int, EventBudgetElement>
*/
@@ -119,6 +125,7 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
$this->comment = new CommentEmbeddable();
$this->themes = new ArrayCollection();
$this->budgetElements = new ArrayCollection();
$this->animators = new ArrayCollection();
}
public function addBudgetElement(EventBudgetElement $budgetElement)
@@ -176,17 +183,28 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
$this->themes->removeElement($theme);
}
/**
* @return Center
*/
public function getAnimators(): Collection
{
return $this->animators;
}
public function addAnimator(ThirdParty $tp): self
{
$this->animators->add($tp);
return $this;
}
public function removeAnimator(ThirdParty $tp): void
{
$this->animators->removeElement($tp);
}
public function getCenter(): ?Center
{
return $this->center;
}
/**
* @return Scope
*/
public function getCircle(): ?Scope
{
return $this->circle;
@@ -194,8 +212,6 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
/**
* Get date.
*
* @return \DateTime
*/
public function getDate(): ?\DateTime
{
@@ -204,8 +220,6 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
/**
* Get id.
*
* @return int
*/
public function getId(): ?int
{
@@ -219,8 +233,6 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
/**
* Get label.
*
* @return string
*/
public function getName(): ?string
{
@@ -257,17 +269,12 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
/**
* @deprecated
*
* @return Scope
*/
public function getScope(): ?Scope
{
return $this->getCircle();
}
/**
* @return EventType
*/
public function getType(): ?EventType
{
return $this->type;
@@ -376,14 +383,4 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
{
$this->documents = $documents;
}
public function getOrganizationCost(): string
{
return $this->organizationCost;
}
public function setOrganizationCost(string $organizationCost): void
{
$this->organizationCost = $organizationCost;
}
}