fix code style for AccompanyingPeriodWork - referrers

This commit is contained in:
nobohan 2022-03-10 16:25:05 +01:00
parent 137eb184d0
commit 690a443bdb
3 changed files with 31 additions and 32 deletions

View File

@ -237,6 +237,15 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
return $this; return $this;
} }
public function addReferrer(User $referrer): self
{
if (!$this->referrers->contains($referrer)) {
$this->referrers[] = $referrer;
}
return $this;
}
public function addResult(Result $result): self public function addResult(Result $result): self
{ {
if (!$this->results->contains($result)) { if (!$this->results->contains($result)) {
@ -318,6 +327,14 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
return $this->persons; return $this->persons;
} }
/**
* @return Collection|User[]
*/
public function getReferrers(): Collection
{
return $this->referrers;
}
/** /**
* @return Collection|Result[] * @return Collection|Result[]
*/ */
@ -392,6 +409,13 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
return $this; return $this;
} }
public function removeReferrer(User $referrer): self
{
$this->referrers->removeElement($referrer);
return $this;
}
public function removeResult(Result $result): self public function removeResult(Result $result): self
{ {
$this->results->removeElement($result); $this->results->removeElement($result);
@ -507,28 +531,4 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
return $this; return $this;
} }
/**
* @return Collection|User[]
*/
public function getReferrers(): Collection
{
return $this->referrers;
}
public function addReferrer(User $referrer): self
{
if (!$this->referrers->contains($referrer)) {
$this->referrers[] = $referrer;
}
return $this;
}
public function removeReferrer(User $referrer): self
{
$this->referrers->removeElement($referrer);
return $this;
}
} }

View File

@ -11,12 +11,11 @@ declare(strict_types=1);
namespace Chill\PersonBundle\EventListener; namespace Chill\PersonBundle\EventListener;
use Symfony\Component\Security\Core\Security;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork; use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Symfony\Component\Security\Core\Security;
class AccompanyingPeriodWorkEventListener class AccompanyingPeriodWorkEventListener
{ {
private Security $security; private Security $security;
public function __construct(Security $security) public function __construct(Security $security)

View File

@ -15,10 +15,15 @@ use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
/** /**
* Add referrers to AccompanyingPeriodWork * Add referrers to AccompanyingPeriodWork.
*/ */
final class Version20220310063629 extends AbstractMigration final class Version20220310063629 extends AbstractMigration
{ {
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE chill_person_accompanying_period_work_referrer');
}
public function getDescription(): string public function getDescription(): string
{ {
return 'Add referrers to AccompanyingPeriodWork'; return 'Add referrers to AccompanyingPeriodWork';
@ -32,9 +37,4 @@ final class Version20220310063629 extends AbstractMigration
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_referrer ADD CONSTRAINT FK_3619F5EBB99F6060 FOREIGN KEY (accompanyingperiodwork_id) REFERENCES chill_person_accompanying_period_work (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE chill_person_accompanying_period_work_referrer ADD CONSTRAINT FK_3619F5EBB99F6060 FOREIGN KEY (accompanyingperiodwork_id) REFERENCES chill_person_accompanying_period_work (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_referrer ADD CONSTRAINT FK_3619F5EBA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE chill_person_accompanying_period_work_referrer ADD CONSTRAINT FK_3619F5EBA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
} }
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE chill_person_accompanying_period_work_referrer');
}
} }