mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-03 07:26:12 +00:00
WIP change animator field to animator intern and animator extern
This commit is contained in:
parent
fab03d7c33
commit
495a43a6cd
@ -61,10 +61,16 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
|
||||
private ?User $moderator = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Animator>
|
||||
* @var Collection<int, User>
|
||||
*/
|
||||
#[ORM\OneToMany(mappedBy: 'event', targetEntity: Animator::class)]
|
||||
private Collection $animators;
|
||||
#[ORM\OneToMany(mappedBy: 'event', targetEntity: User::class)]
|
||||
private Collection $animatorsIntern;
|
||||
|
||||
/**
|
||||
* @var Collection<int, ThirdParty>
|
||||
*/
|
||||
#[ORM\OneToMany(mappedBy: 'event', targetEntity: ThirdParty::class)]
|
||||
private Collection $animatorsExtern;
|
||||
|
||||
#[Assert\NotBlank]
|
||||
#[Serializer\Groups(['read'])]
|
||||
@ -129,7 +135,8 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
|
||||
$this->comment = new CommentEmbeddable();
|
||||
$this->themes = new ArrayCollection();
|
||||
$this->budgetElements = new ArrayCollection();
|
||||
$this->animators = new ArrayCollection();
|
||||
$this->animatorsIntern = new ArrayCollection();
|
||||
$this->animatorsExtern = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function addBudgetElement(EventBudgetElement $budgetElement)
|
||||
@ -187,21 +194,38 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
|
||||
$this->themes->removeElement($theme);
|
||||
}
|
||||
|
||||
public function getAnimators(): Collection
|
||||
public function getAnimatorsIntern(): Collection
|
||||
{
|
||||
return $this->animators;
|
||||
return $this->animatorsIntern;
|
||||
}
|
||||
|
||||
public function addAnimator(ThirdParty|User $a): self
|
||||
public function getAnimatorsExtern(): Collection
|
||||
{
|
||||
$this->animators->add($a);
|
||||
return $this->animatorsExtern;
|
||||
}
|
||||
|
||||
public function addAnimatorIntern(User $ai): self
|
||||
{
|
||||
$this->animatorsIntern->add($ai);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeAnimator(ThirdParty|User $a): void
|
||||
public function removeAnimatorIntern(User $ai): void
|
||||
{
|
||||
$this->animators->removeElement($a);
|
||||
$this->animatorsIntern->removeElement($ai);
|
||||
}
|
||||
|
||||
public function addAnimatorExtern(User $ae): self
|
||||
{
|
||||
$this->animatorsExtern->add($ae);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeAnimatorExtern(User $ae): void
|
||||
{
|
||||
$this->animatorsExtern->removeElement($ae);
|
||||
}
|
||||
|
||||
public function getCenter(): Center
|
||||
|
@ -68,20 +68,15 @@ class EventType extends AbstractType
|
||||
->add('moderator', PickUserDynamicType::class, [
|
||||
'label' => 'Pick a moderator',
|
||||
])
|
||||
->add('animators', ChillCollectionType::class, [
|
||||
'entry_type' => PickAnimatorType::class,
|
||||
'entry_options' => [
|
||||
'label' => false,
|
||||
],
|
||||
'allow_add' => true,
|
||||
'allow_delete' => true,
|
||||
'by_reference' => false,
|
||||
'prototype' => true,
|
||||
'label' => 'Animators',
|
||||
'help' => 'Add users or third parties who will animate this event',
|
||||
'attr' => [
|
||||
'data-collection' => 'true', // For JS handling
|
||||
],
|
||||
->add('animatorsIntern', PickUserDynamicType::class, [
|
||||
'multiple' => true,
|
||||
'label' => 'Pick an internal animator',
|
||||
'required' => false,
|
||||
])
|
||||
->add('animatorsExtern', PickThirdpartyDynamicType::class, [
|
||||
'multiple' => true,
|
||||
'label' => 'Pick an external animator',
|
||||
'required' => false,
|
||||
])
|
||||
->add('budgetElements', ChillCollectionType::class, [
|
||||
'entry_type' => AddEventBudgetElementType::class,
|
||||
|
@ -20,7 +20,8 @@
|
||||
{{ form_row(form.type, { label: "Event type" }) }}
|
||||
{{ form_row(form.themes) }}
|
||||
{{ form_row(form.moderator) }}
|
||||
{{ form_row(form.animators) }}
|
||||
{{ form_row(form.animatorsIntern) }}
|
||||
{{ form_row(form.animatorsExtern) }}
|
||||
{{ form_row(form.location) }}
|
||||
<div id="location"></div>
|
||||
{{ form_row(form.budgetElements) }}
|
||||
|
@ -1,63 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\Migrations\Event;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20250619102259 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add animator entity to event module';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql(<<<'SQL'
|
||||
CREATE SEQUENCE chill_event_animator_id_seq INCREMENT BY 1 MINVALUE 1 START 1
|
||||
SQL);
|
||||
$this->addSql(<<<'SQL'
|
||||
CREATE TABLE chill_event_animator (id INT NOT NULL, thirdparty_id INT DEFAULT NULL, user_id INT DEFAULT NULL, event_id INT NOT NULL, PRIMARY KEY(id))
|
||||
SQL);
|
||||
$this->addSql(<<<'SQL'
|
||||
CREATE INDEX IDX_A7FA35FEC7D3A8E6 ON chill_event_animator (thirdparty_id)
|
||||
SQL);
|
||||
$this->addSql(<<<'SQL'
|
||||
CREATE INDEX IDX_A7FA35FEA76ED395 ON chill_event_animator (user_id)
|
||||
SQL);
|
||||
$this->addSql(<<<'SQL'
|
||||
CREATE INDEX IDX_A7FA35FE71F7E88B ON chill_event_animator (event_id)
|
||||
SQL);
|
||||
$this->addSql(<<<'SQL'
|
||||
ALTER TABLE chill_event_animator ADD CONSTRAINT FK_A7FA35FEC7D3A8E6 FOREIGN KEY (thirdparty_id) REFERENCES chill_3party.third_party (id) NOT DEFERRABLE INITIALLY IMMEDIATE
|
||||
SQL);
|
||||
$this->addSql(<<<'SQL'
|
||||
ALTER TABLE chill_event_animator ADD CONSTRAINT FK_A7FA35FEA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE
|
||||
SQL);
|
||||
$this->addSql(<<<'SQL'
|
||||
ALTER TABLE chill_event_animator ADD CONSTRAINT FK_A7FA35FE71F7E88B FOREIGN KEY (event_id) REFERENCES chill_event_event (id) NOT DEFERRABLE INITIALLY IMMEDIATE
|
||||
SQL);
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql(<<<'SQL'
|
||||
DROP SEQUENCE chill_event_animator_id_seq CASCADE
|
||||
SQL);
|
||||
$this->addSql(<<<'SQL'
|
||||
ALTER TABLE chill_event_animator DROP CONSTRAINT FK_A7FA35FEC7D3A8E6
|
||||
SQL);
|
||||
$this->addSql(<<<'SQL'
|
||||
ALTER TABLE chill_event_animator DROP CONSTRAINT FK_A7FA35FEA76ED395
|
||||
SQL);
|
||||
$this->addSql(<<<'SQL'
|
||||
ALTER TABLE chill_event_animator DROP CONSTRAINT FK_A7FA35FE71F7E88B
|
||||
SQL);
|
||||
$this->addSql(<<<'SQL'
|
||||
DROP TABLE chill_event_animator
|
||||
SQL);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user