Compare commits

..

6 Commits

Author SHA1 Message Date
148221cdc7 fix namespace of 'self' 2021-04-27 23:21:15 +02:00
58047faac6 force type for connection parameter 2021-04-27 23:20:49 +02:00
40dda65006 fix import namespacees 2021-04-27 23:20:25 +02:00
Pol Dellaiera
054a28ecf4 refactor: Update source code based on PHP conventions. 2021-04-26 17:18:38 +02:00
Pol Dellaiera
6b2eda0f94 chore: Add/update static files. 2021-04-26 15:44:37 +02:00
Pol Dellaiera
1359f1ba58 chore: Update composer.json 2021-04-26 14:02:26 +02:00
23 changed files with 128 additions and 1787 deletions

View File

@@ -9,19 +9,18 @@
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\DataFixtures\ORM;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Chill\MainBundle\DataFixtures\ORM\LoadPermissionsGroup;
use Chill\MainBundle\DataFixtures\ORM\LoadScopes;
use Chill\MainBundle\Entity\RoleScope;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Chill\MainBundle\DataFixtures\ORM\LoadPermissionsGroup;
use Chill\MainBundle\Entity\RoleScope;
use Chill\MainBundle\DataFixtures\ORM\LoadScopes;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use function in_array;
declare(strict_types=1);
class LoadActivitytACL extends AbstractFixture implements OrderedFixtureInterface
{
@@ -47,7 +46,7 @@ class LoadActivitytACL extends AbstractFixture implements OrderedFixtureInterfac
break;
case 'administrative':
case 'direction':
if (in_array($scope->getName()['en'], ['administrative', 'social'], true)) {
if (\in_array($scope->getName()['en'], ['administrative', 'social'], true)) {
break 2; // we do not want any power on social or administrative
}

View File

@@ -21,7 +21,6 @@ use Chill\PersonBundle\Privacy\PrivacyEvent;
use Chill\PersonBundle\Repository\PersonRepository;
use Chill\PersonBundle\Search\SimilarPersonMatcher;
use DateTime;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -39,11 +38,6 @@ class PersonController extends AbstractController
*/
protected $configPersonAltNameHelper;
/**
* @var EntityManagerInterface
*/
protected $em;
/**
* @var EventDispatcherInterface
*/
@@ -81,8 +75,7 @@ class PersonController extends AbstractController
PersonRepository $personRepository,
ConfigPersonAltNamesHelper $configPersonAltNameHelper,
LoggerInterface $logger,
ValidatorInterface $validator,
EntityManagerInterface $em
ValidatorInterface $validator
) {
$this->similarPersonMatcher = $similarPersonMatcher;
$this->translator = $translator;
@@ -91,7 +84,6 @@ class PersonController extends AbstractController
$this->personRepository = $personRepository;
$this->logger = $logger;
$this->validator = $validator;
$this->em = $em;
}
public function createAction(Request $request)
@@ -265,8 +257,6 @@ class PersonController extends AbstractController
}
$this->logger->info('Person created without errors');
$this->em->persist($person);
$alternatePersons = $this->similarPersonMatcher
->matchPerson($person);

View File

@@ -1,321 +0,0 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace App\Entity\Chill\PersonBundle\Entity\AccompanyingPeriod;
use App\Entity\Chill\PersonBundle\Entity\SocialWork\Result;
use App\Entity\Chill\PersonBundle\Entity\SocialWork\SocialAction;
use App\Repository\Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use DateTimeInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=AccompanyingPeriodWorkRepository::class)
* @ORM\Table(name="chill_person_accompanying_period_work")
*/
class AccompanyingPeriodWork
{
/**
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
*/
private $accompanyingPeriod;
/**
* @ORM\Column(type="datetime")
*/
private $createdAt;
/**
* @ORM\Column(type="boolean")
*/
private $createdAutomatically;
/**
* @ORM\Column(type="text")
*/
private $createdAutomaticallyReason;
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=false)
*/
private $createdBy;
/**
* @ORM\Column(type="datetime")
*/
private $endDate;
/**
* @ORM\OneToMany(targetEntity=AccompanyingPeriodWorkGoal::class, mappedBy="accompanyingPeriodWork")
*/
private $goals;
/**
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
*
* In schema : traitant
*/
private $handlingThierParty;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="text")
*/
private $note;
/**
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorks")
* @ORM\JoinTable(name="chill_person_accompanying_period_work_result")
*/
private $results;
/**
* @ORM\ManyToOne(targetEntity=SocialAction::class)
*/
private $socialAction;
/**
* @ORM\Column(type="datetime")
*/
private $startDate;
/**
* @ORM\ManyToMany(targetEntity=ThirdParty::class)
* @ORM\JoinTable(name="chill_person_accompanying_period_work_third_party")
*
* In schema : intervenants
*/
private $thirdParties;
public function __construct()
{
$this->goals = new ArrayCollection();
$this->results = new ArrayCollection();
$this->thirdParties = new ArrayCollection();
}
public function addGoal(AccompanyingPeriodWorkGoal $goal): self
{
if (!$this->goals->contains($goal)) {
$this->goals[] = $goal;
$goal->setAccompanyingPeriodWork2($this);
}
return $this;
}
public function addResult(Result $result): self
{
if (!$this->results->contains($result)) {
$this->results[] = $result;
}
return $this;
}
public function addThirdParty(ThirdParty $thirdParty): self
{
if (!$this->thirdParties->contains($thirdParty)) {
$this->thirdParties[] = $thirdParty;
}
return $this;
}
public function getAccompanyingPeriod(): ?AccompanyingPeriod
{
return $this->accompanyingPeriod;
}
public function getCreatedAt(): ?DateTimeInterface
{
return $this->createdAt;
}
public function getCreatedAutomatically(): ?bool
{
return $this->createdAutomatically;
}
public function getCreatedAutomaticallyReason(): ?string
{
return $this->createdAutomaticallyReason;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function getEndDate(): ?DateTimeInterface
{
return $this->endDate;
}
/**
* @return AccompanyingPeriodWorkGoal[]|Collection
*/
public function getGoals(): Collection
{
return $this->goals;
}
public function getHandlingThierParty(): ?ThirdParty
{
return $this->handlingThierParty;
}
public function getId(): ?int
{
return $this->id;
}
public function getNote(): ?string
{
return $this->note;
}
/**
* @return Collection|Result[]
*/
public function getResults(): Collection
{
return $this->results;
}
public function getSocialAction(): ?SocialAction
{
return $this->socialAction;
}
public function getStartDate(): ?DateTimeInterface
{
return $this->startDate;
}
/**
* @return Collection|ThirdParty[]
*/
public function getThirdParties(): Collection
{
return $this->thirdParties;
}
public function removeGoal(AccompanyingPeriodWorkGoal $goal): self
{
if ($this->goals->removeElement($goal)) {
// set the owning side to null (unless already changed)
if ($goal->getAccompanyingPeriodWork2() === $this) {
$goal->setAccompanyingPeriodWork2(null);
}
}
return $this;
}
public function removeResult(Result $result): self
{
$this->results->removeElement($result);
return $this;
}
public function removeThirdParty(ThirdParty $thirdParty): self
{
$this->thirdParties->removeElement($thirdParty);
return $this;
}
public function setAccompanyingPeriod(?AccompanyingPeriod $accompanyingPeriod): self
{
$this->accompanyingPeriod = $accompanyingPeriod;
return $this;
}
public function setCreatedAt(DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function setCreatedAutomatically(bool $createdAutomatically): self
{
$this->createdAutomatically = $createdAutomatically;
return $this;
}
public function setCreatedAutomaticallyReason(string $createdAutomaticallyReason): self
{
$this->createdAutomaticallyReason = $createdAutomaticallyReason;
return $this;
}
public function setCreatedBy(?User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function setEndDate(DateTimeInterface $endDate): self
{
$this->endDate = $endDate;
return $this;
}
public function setHandlingThierParty(?ThirdParty $handlingThierParty): self
{
$this->handlingThierParty = $handlingThierParty;
return $this;
}
public function setNote(string $note): self
{
$this->note = $note;
return $this;
}
public function setSocialAction(?SocialAction $socialAction): self
{
$this->socialAction = $socialAction;
return $this;
}
public function setStartDate(DateTimeInterface $startDate): self
{
$this->startDate = $startDate;
return $this;
}
}

View File

@@ -1,126 +0,0 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace App\Entity\Chill\PersonBundle\Entity\AccompanyingPeriod;
use App\Entity\Chill\PersonBundle\Entity\SocialWork\Goal;
use App\Entity\Chill\PersonBundle\Entity\SocialWork\Result;
use App\Repository\Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkGoalRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=AccompanyingPeriodWorkGoalRepository::class)
* @ORM\Table(name="chill_person_accompanying_period_work_goal")
*/
class AccompanyingPeriodWorkGoal
{
/**
* @ORM\ManyToOne(targetEntity=AccompanyingPeriodWork::class, inversedBy="goals")
*/
private $accompanyingPeriodWork;
/**
* @ORM\ManyToOne(targetEntity=Goal::class)
*/
private $goal;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="text")
*/
private $note;
/**
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorkGoals")
* @ORM\JoinTable(name="chill_person_accompanying_period_work_goal_result")
*/
private $results;
public function __construct()
{
$this->results = new ArrayCollection();
}
public function addResult(Result $result): self
{
if (!$this->results->contains($result)) {
$this->results[] = $result;
}
return $this;
}
public function getAccompanyingPeriodWork(): ?AccompanyingPeriodWork
{
return $this->accompanyingPeriodWork;
}
public function getGoal(): ?Goal
{
return $this->goal;
}
public function getId(): ?int
{
return $this->id;
}
public function getNote(): ?string
{
return $this->note;
}
/**
* @return Collection|Result[]
*/
public function getResults(): Collection
{
return $this->results;
}
public function removeResult(Result $result): self
{
$this->results->removeElement($result);
return $this;
}
public function setAccompanyingPeriodWork(?AccompanyingPeriodWork $accompanyingPeriodWork): self
{
$this->accompanyingPeriodWork = $accompanyingPeriodWork;
return $this;
}
public function setGoal(?Goal $goal): self
{
$this->goal = $goal;
return $this;
}
public function setNote(string $note): self
{
$this->note = $note;
return $this;
}
}

View File

@@ -1,105 +0,0 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace App\Entity\Chill\PersonBundle\Entity\SocialWork;
use App\Repository\Chill\PersonBundle\Entity\SocialWork\EvaluationRepository;
use DateInterval;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=EvaluationRepository::class)
* @ORM\Table(name="chill_person_social_work_evaluation")
*/
class Evaluation
{
/**
* @ORM\Column(type="dateinterval")
*/
private $delay;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="dateinterval")
*/
private $notificationDelay;
/**
* @ORM\ManyToOne(targetEntity=SocialAction::class)
*/
private $socialAction;
/**
* @ORM\Column(type="json")
*/
private $title = [];
public function getDelay(): ?DateInterval
{
return $this->delay;
}
public function getId(): ?int
{
return $this->id;
}
public function getNotificationDelay(): ?DateInterval
{
return $this->notificationDelay;
}
public function getSocialAction(): ?SocialAction
{
return $this->socialAction;
}
public function getTitle(): array
{
return $this->title;
}
public function setDelay(DateInterval $delay): self
{
$this->delay = $delay;
return $this;
}
public function setNotificationDelay(DateInterval $notificationDelay): self
{
$this->notificationDelay = $notificationDelay;
return $this;
}
public function setSocialAction(?SocialAction $socialAction): self
{
$this->socialAction = $socialAction;
return $this;
}
public function setTitle(array $title): self
{
$this->title = $title;
return $this;
}
}

View File

@@ -1,133 +0,0 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace App\Entity\Chill\PersonBundle\Entity\SocialWork;
use App\Repository\Chill\PersonBundle\Entity\SocialWork\GoalRepository;
use DateTimeInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=GoalRepository::class)
* @ORM\Table(name="chill_person_social_work_goal")
*/
class Goal
{
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $desactivationDate;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="goals")
* @ORM\JoinTable(name="chill_person_social_work_goal_result")
*/
private $results;
/**
* @ORM\ManyToMany(targetEntity=SocialAction::class, mappedBy="goals")
*/
private $socialActions;
/**
* @ORM\Column(type="json")
*/
private $title = [];
public function __construct()
{
$this->socialActions = new ArrayCollection();
$this->results = new ArrayCollection();
}
public function addResult(Result $result): self
{
if (!$this->results->contains($result)) {
$this->results[] = $result;
}
return $this;
}
public function addSocialAction(SocialAction $socialAction): self
{
if (!$this->socialActions->contains($socialAction)) {
$this->socialActions[] = $socialAction;
}
return $this;
}
public function getDesactivationDate(): ?DateTimeInterface
{
return $this->desactivationDate;
}
/**
* @return Collection|Result[]
*/
public function getResults(): Collection
{
return $this->results;
}
/**
* @return Collection|SocialAction[]
*/
public function getSocialActions(): Collection
{
return $this->socialActions;
}
public function getTitle(): array
{
return $this->title;
}
public function removeResult(Result $result): self
{
$this->results->removeElement($result);
return $this;
}
public function removeSocialAction(SocialAction $socialAction): self
{
$this->socialActions->removeElement($socialAction);
return $this;
}
public function setDesactivationDate(?DateTimeInterface $desactivationDate): self
{
$this->desactivationDate = $desactivationDate;
return $this;
}
public function setTitle(array $title): self
{
$this->title = $title;
return $this;
}
}

View File

@@ -1,199 +0,0 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace App\Entity\Chill\PersonBundle\Entity\SocialWork;
use App\Entity\Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use App\Entity\Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkGoal;
use App\Repository\Chill\PersonBundle\Entity\SocialWork\ResultRepository;
use DateTimeInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ResultRepository::class)
* @ORM\Table(name="chill_person_social_work_result")
*/
class Result
{
/**
* @ORM\ManyToMany(targetEntity=AccompanyingPeriodWorkGoal::class, mappedBy="results")
*/
private $accompanyingPeriodWorkGoals;
/**
* @ORM\ManyToMany(targetEntity=AccompanyingPeriodWork::class, mappedBy="results")
*/
private $accompanyingPeriodWorks;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $desactivationDate;
/**
* @ORM\ManyToMany(targetEntity=Goal::class, mappedBy="results")
*/
private $goals;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToMany(targetEntity=SocialAction::class, mappedBy="results")
*/
private $socialActions;
/**
* @ORM\Column(type="json")
*/
private $title = [];
public function __construct()
{
$this->socialActions = new ArrayCollection();
$this->goals = new ArrayCollection();
$this->accompanyingPeriodWorks = new ArrayCollection();
$this->accompanyingPeriodWorkGoals = new ArrayCollection();
}
public function addAccompanyingPeriodWork(AccompanyingPeriodWork $accompanyingPeriod): self
{
if (!$this->accompanyingPeriodWorks->contains($accompanyingPeriod)) {
$this->accompanyingPeriodWorks[] = $accompanyingPeriod;
}
return $this;
}
public function addAccompanyingPeriodWorkGoal(AccompanyingPeriodWorkGoal $accompanyingPeriodWorkGoal): self
{
if (!$this->accompanyingPeriodWorkGoals->contains($accompanyingPeriodWorkGoal)) {
$this->accompanyingPeriodWorkGoals[] = $accompanyingPeriodWorkGoal;
}
return $this;
}
public function addGoal(Goal $goal): self
{
if (!$this->goals->contains($goal)) {
$this->goals[] = $goal;
}
return $this;
}
public function addSocialAction(SocialAction $socialAction): self
{
if (!$this->socialActions->contains($socialAction)) {
$this->socialActions[] = $socialAction;
}
return $this;
}
/**
* @return AccompanyingPeriodWorkGoal[]|Collection
*/
public function getAccompanyingPeriodWorkGoals(): Collection
{
return $this->accompanyingPeriodWorkGoals;
}
/**
* @return AccompanyingPeriodWork[]|Collection
*/
public function getAccompanyingPeriodWorks(): Collection
{
return $this->accompanyingPeriodWorks;
}
public function getDesactivationDate(): ?DateTimeInterface
{
return $this->desactivationDate;
}
/**
* @return Collection|Goal[]
*/
public function getGoals(): Collection
{
return $this->goals;
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return Collection|SocialAction[]
*/
public function getSocialActions(): Collection
{
return $this->socialActions;
}
public function getTitle(): array
{
return $this->title;
}
public function removeAccompanyingPeriodWork(AccompanyingPeriodWork $accompanyingPeriod): self
{
$this->accompanyingPeriodWorks->removeElement($accompanyingPeriod);
return $this;
}
public function removeAccompanyingPeriodWorkGoal(AccompanyingPeriodWorkGoal $accompanyingPeriodWorkGoal): self
{
$this->accompanyingPeriodWorkGoals->removeElement($accompanyingPeriodWorkGoal);
return $this;
}
public function removeGoal(Goal $goal): self
{
$this->goals->removeElement($goal);
return $this;
}
public function removeSocialAction(SocialAction $socialAction): self
{
$this->socialActions->removeElement($socialAction);
return $this;
}
public function setDesactivationDate(?DateTimeInterface $desactivationDate): self
{
$this->desactivationDate = $desactivationDate;
return $this;
}
public function setTitle(array $title): self
{
$this->title = $title;
return $this;
}
}

View File

@@ -1,227 +0,0 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace App\Entity\Chill\PersonBundle\Entity\SocialWork;
use App\Repository\Chill\PersonBundle\Entity\SocialWork\SocialActionRepository;
use DateInterval;
use DateTimeInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=SocialActionRepository::class)
* @ORM\Table(name="chill_person_social_action")
*/
class SocialAction
{
/**
* @ORM\OneToMany(targetEntity=SocialAction::class, mappedBy="parent")
*/
private $children;
/**
* @ORM\Column(type="dateinterval")
*/
private $defaultNotificationDelay;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $desactivationDate;
/**
* @ORM\ManyToMany(targetEntity=Goal::class, inversedBy="socialActions")
* @ORM\JoinTable(name="chill_person_social_action_goal")
*/
private $goals;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=SocialIssue::class, inversedBy="socialActions")
*/
private $issue;
/**
* @ORM\ManyToOne(targetEntity=SocialAction::class, inversedBy="children")
*/
private $parent;
/**
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="socialActions")
* @ORM\JoinTable(name="chill_person_social_action_result")
*/
private $results;
/**
* @ORM\Column(type="json")
*/
private $title = [];
public function __construct()
{
$this->children = new ArrayCollection();
$this->goals = new ArrayCollection();
$this->results = new ArrayCollection();
}
public function addChild(self $child): self
{
if (!$this->children->contains($child)) {
$this->children[] = $child;
$child->setParent($this);
}
return $this;
}
public function addGoal(Goal $goal): self
{
if (!$this->goals->contains($goal)) {
$this->goals[] = $goal;
}
return $this;
}
public function addResult(Result $result): self
{
if (!$this->results->contains($result)) {
$this->results[] = $result;
}
return $this;
}
/**
* @return Collection|self[]
*/
public function getChildren(): Collection
{
return $this->children;
}
public function getDefaultNotificationDelay(): ?DateInterval
{
return $this->defaultNotificationDelay;
}
public function getDesactivationDate(): ?DateTimeInterface
{
return $this->desactivationDate;
}
/**
* @return Collection|Goal[]
*/
public function getGoals(): Collection
{
return $this->goals;
}
public function getId(): ?int
{
return $this->id;
}
public function getIssue(): ?SocialIssue
{
return $this->issue;
}
public function getParent(): ?self
{
return $this->parent;
}
/**
* @return Collection|Result[]
*/
public function getResults(): Collection
{
return $this->results;
}
public function getTitle(): array
{
return $this->title;
}
public function removeChild(self $child): self
{
if ($this->children->removeElement($child)) {
// set the owning side to null (unless already changed)
if ($child->getParent() === $this) {
$child->setParent(null);
}
}
return $this;
}
public function removeGoal(Goal $goal): self
{
$this->goals->removeElement($goal);
return $this;
}
public function removeResult(Result $result): self
{
$this->results->removeElement($result);
return $this;
}
public function setDefaultNotificationDelay(DateInterval $defaultNotificationDelay): self
{
$this->defaultNotificationDelay = $defaultNotificationDelay;
return $this;
}
public function setDesactivationDate(?DateTimeInterface $desactivationDate): self
{
$this->desactivationDate = $desactivationDate;
return $this;
}
public function setIssue(?SocialIssue $issue): self
{
$this->issue = $issue;
return $this;
}
public function setParent(?self $parent): self
{
$this->parent = $parent;
return $this;
}
public function setTitle(array $title): self
{
$this->title = $title;
return $this;
}
}

View File

@@ -1,166 +0,0 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace App\Entity\Chill\PersonBundle\Entity\SocialWork;
use App\Repository\Chill\PersonBundle\Entity\SocialWork\SocialIssueRepository;
use DateTimeInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=SocialIssueRepository::class)
* @ORM\Table(name="chill_person_social_issue")
*/
class SocialIssue
{
/**
* @ORM\OneToMany(targetEntity=SocialIssue::class, mappedBy="parent")
*/
private $children;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $desactivationDate;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=SocialIssue::class, inversedBy="children")
*/
private $parent;
/**
* @ORM\OneToMany(targetEntity=SocialAction::class, mappedBy="issue")
*/
private $socialActions;
/**
* @ORM\Column(type="json")
*/
private $title = [];
public function __construct()
{
$this->children = new ArrayCollection();
$this->socialActions = new ArrayCollection();
}
public function addChild(self $child): self
{
if (!$this->children->contains($child)) {
$this->children[] = $child;
$child->setParent($this);
}
return $this;
}
public function addSocialAction(SocialAction $socialAction): self
{
if (!$this->socialActions->contains($socialAction)) {
$this->socialActions[] = $socialAction;
$socialAction->setSocialIssue($this);
}
return $this;
}
/**
* @return Collection|self[]
*/
public function getChildren(): Collection
{
return $this->children;
}
public function getDesactivationDate(): ?DateTimeInterface
{
return $this->desactivationDate;
}
public function getId(): ?int
{
return $this->id;
}
public function getParent(): ?self
{
return $this->parent;
}
/**
* @return Collection|SocialAction[]
*/
public function getSocialActions(): Collection
{
return $this->socialActions;
}
public function getTitle(): array
{
return $this->title;
}
public function removeChild(self $child): self
{
if ($this->children->removeElement($child)) {
// set the owning side to null (unless already changed)
if ($child->getParent() === $this) {
$child->setParent(null);
}
}
return $this;
}
public function removeSocialAction(SocialAction $socialAction): self
{
if ($this->socialActions->removeElement($socialAction)) {
// set the owning side to null (unless already changed)
if ($socialAction->getSocialIssue() === $this) {
$socialAction->setSocialIssue(null);
}
}
return $this;
}
public function setDesactivationDate(?DateTimeInterface $desactivationDate): self
{
$this->desactivationDate = $desactivationDate;
return $this;
}
public function setParent(?self $parent): self
{
$this->parent = $parent;
return $this;
}
public function setTitle(array $title): self
{
$this->title = $title;
return $this;
}
}

View File

@@ -1,32 +0,0 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace App\Repository\Chill\PersonBundle\Entity\AccompanyingPeriod;
use App\Entity\Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkGoal;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method AccompanyingPeriodWorkGoal|null find($id, $lockMode = null, $lockVersion = null)
* @method AccompanyingPeriodWorkGoal|null findOneBy(array $criteria, array $orderBy = null)
* @method AccompanyingPeriodWorkGoal[] findAll()
* @method AccompanyingPeriodWorkGoal[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class AccompanyingPeriodWorkGoalRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, AccompanyingPeriodWorkGoal::class);
}
}

View File

@@ -1,32 +0,0 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace App\Repository\Chill\PersonBundle\Entity\AccompanyingPeriod;
use App\Entity\Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method AccompanyingPeriodWork|null find($id, $lockMode = null, $lockVersion = null)
* @method AccompanyingPeriodWork|null findOneBy(array $criteria, array $orderBy = null)
* @method AccompanyingPeriodWork[] findAll()
* @method AccompanyingPeriodWork[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class AccompanyingPeriodWorkRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, AccompanyingPeriodWork::class);
}
}

View File

@@ -1,32 +0,0 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace App\Repository\Chill\PersonBundle\Entity\SocialWork;
use App\Entity\Chill\PersonBundle\Entity\SocialWork\Evaluation;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method Evaluation|null find($id, $lockMode = null, $lockVersion = null)
* @method Evaluation|null findOneBy(array $criteria, array $orderBy = null)
* @method Evaluation[] findAll()
* @method Evaluation[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class EvaluationRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Evaluation::class);
}
}

View File

@@ -1,32 +0,0 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace App\Repository\Chill\PersonBundle\Entity\SocialWork;
use App\Entity\Chill\PersonBundle\Entity\SocialWork\Goal;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method Goal|null find($id, $lockMode = null, $lockVersion = null)
* @method Goal|null findOneBy(array $criteria, array $orderBy = null)
* @method Goal[] findAll()
* @method Goal[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class GoalRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Goal::class);
}
}

View File

@@ -1,32 +0,0 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace App\Repository\Chill\PersonBundle\Entity\SocialWork;
use App\Entity\Chill\PersonBundle\Entity\SocialWork\Result;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method Result|null find($id, $lockMode = null, $lockVersion = null)
* @method Result|null findOneBy(array $criteria, array $orderBy = null)
* @method Result[] findAll()
* @method Result[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ResultRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Result::class);
}
}

View File

@@ -1,32 +0,0 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace App\Repository\Chill\PersonBundle\Entity\SocialWork;
use App\Entity\Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method SocialAction|null find($id, $lockMode = null, $lockVersion = null)
* @method SocialAction|null findOneBy(array $criteria, array $orderBy = null)
* @method SocialAction[] findAll()
* @method SocialAction[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class SocialActionRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, SocialAction::class);
}
}

View File

@@ -1,32 +0,0 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace App\Repository\Chill\PersonBundle\Entity\SocialWork;
use App\Entity\Chill\PersonBundle\Entity\SocialWork\SocialIssue;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method SocialIssue|null find($id, $lockMode = null, $lockVersion = null)
* @method SocialIssue|null findOneBy(array $criteria, array $orderBy = null)
* @method SocialIssue[] findAll()
* @method SocialIssue[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class SocialIssueRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, SocialIssue::class);
}
}

View File

@@ -16,7 +16,7 @@ namespace Chill\PersonBundle\Tests\Controller;
use DateTime;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\DomCrawler\Form;
use Chill\MainBundle\Test\PrepareClientTrait;
use function in_array;
/**
* Test creation and deletion for persons.
@@ -26,28 +26,21 @@ use Chill\MainBundle\Test\PrepareClientTrait;
*/
final class PersonControllerCreateTest extends WebTestCase
{
use PrepareClientTrait;
public const BIRTHDATE_INPUT = 'chill_personbundle_person_creation[birthdate]';
const FIRSTNAME_INPUT = 'chill_personbundle_person_creation[firstName]';
const LASTNAME_INPUT = "chill_personbundle_person_creation[lastName]";
const GENDER_INPUT = "chill_personbundle_person_creation[gender]";
const BIRTHDATE_INPUT = "chill_personbundle_person_creation[birthdate]";
const CREATEDATE_INPUT = "chill_personbundle_person_creation[creation_date]";
const CENTER_INPUT = "chill_personbundle_person_creation[center]";
public const CENTER_INPUT = 'chill_personbundle_person_creation[center]';
const LONG_TEXT = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosq. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta.Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosq.";
public const CREATEDATE_INPUT = 'chill_personbundle_person_creation[creation_date]';
public function setUp()
{
$this->client = $this::getClientAuthenticated();
}
public const FIRSTNAME_INPUT = 'chill_personbundle_person_creation[firstName]';
/**
*
* @param Form $creationForm
*/
private function fillAValidCreationForm(Form &$creationForm,
$firstname = 'God', $lastname = 'Jesus')
public const GENDER_INPUT = 'chill_personbundle_person_creation[gender]';
public const LASTNAME_INPUT = 'chill_personbundle_person_creation[lastName]';
public const LONG_TEXT = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosq. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta.Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosq.';
public static function tearDownAfterClass()
{
self::bootKernel();
$em = self::$kernel->getContainer()->get('doctrine.orm.entity_manager');
@@ -76,7 +69,8 @@ final class PersonControllerCreateTest extends WebTestCase
*/
public function testAddAPersonPage()
{
$client = $this->client;
$client = $this->getAuthenticatedClient();
$crawler = $client->request('GET', '/fr/person/new');
self::assertTrue(
@@ -112,19 +106,29 @@ final class PersonControllerCreateTest extends WebTestCase
);
$genderType = $form->get(self::GENDER_INPUT);
$this->assertEquals('radio', $genderType->getType(),
'The gender input has radio buttons');
$this->assertEquals(3, count($genderType->availableOptionValues()),
'The gender input has three options: man, women and undefined');
$this->assertTrue(in_array('man', $genderType->availableOptionValues()),
'gender has "homme" option');
$this->assertTrue(in_array('woman', $genderType->availableOptionValues()),
'gender has "femme" option');
$this->assertFalse($genderType->hasValue(), 'The gender input is not checked');
self::assertEquals(
'radio',
$genderType->getType(),
'The gender input has two radio button: man and women'
);
self::assertCount(
2,
$genderType->availableOptionValues(),
'The gender input has two radio button: man and women'
);
self::assertTrue(
in_array('man', $genderType->availableOptionValues(), true),
'gender has "homme" option'
);
self::assertTrue(
in_array('woman', $genderType->availableOptionValues(), true),
'gender has "femme" option'
);
self::assertFalse($genderType->hasValue(), 'The gender input is not checked');
$today = new \DateTime();
$this->assertEquals($today->format('d-m-Y'), $form->get(self::CREATEDATE_INPUT)
->getValue(), 'The creation date input has the current date by default');
$today = new DateTime();
self::assertEquals($today->format('d-m-Y'), $form->get(self::CREATEDATE_INPUT)
->getValue(), 'The creation date input has the current date by default');
return $form;
}
@@ -132,14 +136,50 @@ final class PersonControllerCreateTest extends WebTestCase
/**
* @depends testAddAPersonPage
*/
public function testForgedNullGender(Form $form)
public function testFirstnameTooLong(Form $form)
{
$form->get(self::FIRSTNAME_INPUT)->setValue('john');
$form->get(self::LASTNAME_INPUT)->setValue('doe');
$date = new \DateTime('1947-02-01');
$form->get(self::BIRTHDATE_INPUT)->setValue($date->format('d-m-Y'));
$this->client->submit($form);
$this->assertResponseStatusCodeSame(500);
$client = $this->getAuthenticatedClient();
$this->fillAValidCreationForm($form);
$form->get(self::FIRSTNAME_INPUT)->setValue(mb_substr(self::LONG_TEXT, 0, 256));
$crawler = $client->submit($form);
self::assertEquals(
1,
$crawler->filter('.error')->count(),
'An error message is shown if we fill more than 255 characters in firstname'
);
}
/**
* @depends testAddAPersonPage
*/
public function testGenderIsNull(Form $form)
{
$this->fillAValidCreationForm($form);
$form->get(self::GENDER_INPUT)->disableValidation()->setValue(null);
$crawler = $this->getAuthenticatedClient()->submit($form);
self::assertEquals(
1,
$crawler->filter('.error')->count(),
'A message is shown if gender is not set'
);
}
/**
* @depends testAddAPersonPage
*/
public function testLastnameTooLong(Form $form)
{
$this->fillAValidCreationForm($form);
$form->get(self::LASTNAME_INPUT)->setValue(mb_substr(self::LONG_TEXT, 0, 256));
$crawler = $this->getAuthenticatedClient()->submit($form);
self::assertEquals(
1,
$crawler->filter('.error')->count(),
'An error message is shown if we fill more than 255 characters in lastname'
);
}
/**
@@ -201,10 +241,13 @@ final class PersonControllerCreateTest extends WebTestCase
public function testValidForm(Form $form)
{
$this->fillAValidCreationForm($form);
$client = $this->client;
$client = $this->getAuthenticatedClient();
$client->submit($form);
$this->assertTrue((bool)$client->getResponse()->isRedirect(),
"a valid form redirect to url /{_locale}/person/{personId}/general/edit");
self::assertTrue(
$client->getResponse()->isRedirect(),
'a valid form redirect to url /{_locale}/person/{personId}/general/edit'
);
$client->followRedirect();
// visualize regexp here : http://jex.im/regulex/#!embed=false&flags=&re=%2Ffr%2Fperson%2F[1-9][0-9]*%2Fgeneral%2Fedit%24
@@ -224,30 +267,13 @@ final class PersonControllerCreateTest extends WebTestCase
return $regexPersonId[1];
}
/**
* Test if, for a given person if its person view page (at the url
* fr/person/$personID/general) is accessible
*
* @param string|int $personId The is of the person
* @depends testValidForm
*/
public function testPersonViewAccessible($personId)
{
$client = $this->client;
$client->request('GET', '/fr/person/'.$personId.'/general');
$this->assertTrue($client->getResponse()->isSuccessful(),
"The person view page is accessible at the URL"
. "/{_locale}/person/{personID}/general");
}
/**
* test adding a person with a user with multi center
* is valid.
*/
public function testValidFormWithMultiCenterUser()
{
$client = $this->getClientAuthenticated('multi_center');
$client = $this->getAuthenticatedClient('multi_center');
$crawler = $client->request('GET', '/fr/person/new');
@@ -282,29 +308,22 @@ final class PersonControllerCreateTest extends WebTestCase
);
}
public function testReviewExistingDetectionInversedLastNameWithFirstName()
{
$client = $this->client;
/**
* @param mixed $firstname
* @param mixed $lastname
*/
private function fillAValidCreationForm(
Form &$creationForm,
$firstname = 'God',
$lastname = 'Jesus'
) {
$creationForm->get(self::FIRSTNAME_INPUT)->setValue($firstname);
$creationForm->get(self::LASTNAME_INPUT)->setValue($lastname);
$creationForm->get(self::GENDER_INPUT)->select('man');
$date = new DateTime('1947-02-01');
$creationForm->get(self::BIRTHDATE_INPUT)->setValue($date->format('d-m-Y'));
$crawler = $client->request('GET', '/fr/person/new');
//test the page is loaded before continuing
$this->assertTrue($client->getResponse()->isSuccessful());
$form = $crawler->selectButton("Ajouter la personne")->form();
$form = $this->fillAValidCreationForm($form, 'Charline', 'dd');
$client->submit($form);
$this->assertContains('Depardieu', $client->getCrawler()->text(),
"check that the page has detected the lastname of a person existing in database");
//inversion
$form = $crawler->selectButton("Ajouter la personne")->form();
$form = $this->fillAValidCreationForm($form, 'dd', 'Charline');
$client->submit($form);
$this->assertContains('Depardieu', $client->getCrawler()->text(),
"check that the page has detected the lastname of a person existing in database");
return $creationForm;
}
/**

View File

@@ -15,7 +15,6 @@ namespace Chill\PersonBundle\Tests\Controller;
//ini_set('memory_limit', '-1');
use Chill\MainBundle\Test\PrepareClientTrait;
use Chill\PersonBundle\Entity\Person;
use Closure;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -30,7 +29,10 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
*/
final class PersonControllerUpdateTest extends WebTestCase
{
use PrepareClientTrait;
/**
* @var string The url using for editing the person's information
*/
private $editUrl;
/**
* @var \Doctrine\ORM\EntityManagerInterface The entity manager
@@ -72,7 +74,10 @@ final class PersonControllerUpdateTest extends WebTestCase
$this->editUrl = '/en/person/' . $this->person->getId() . '/general/edit';
$this->viewUrl = '/en/person/' . $this->person->getId() . '/general';
$this->client = $this->getClientAuthenticated();
$this->client = self::createClient([], [
'PHP_AUTH_USER' => 'center a_social',
'PHP_AUTH_PW' => 'password',
]);
}
protected function tearDown()

View File

@@ -24,6 +24,11 @@ use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
*/
final class PickPersonTypeTest extends KernelTestCase
{
/**
* @var \Symfony\Component\DependencyInjection\ContainerInterface
*/
protected $container;
/**
* @var \Symfony\Component\Form\FormFactoryInterface
*/
@@ -34,23 +39,20 @@ final class PickPersonTypeTest extends KernelTestCase
*/
protected $user;
/**
* @var \Chill\MainBundle\Entity\User
*/
protected $user;
protected function setUp()
{
self::bootKernel();
$this->user = self::$container->get('doctrine.orm.entity_manager')
$this->container = self::$kernel->getContainer();
$this->user = $this->container->get('doctrine.orm.entity_manager')
->getRepository('ChillMainBundle:User')
->findOneBy(['username' => 'multi_center']);
$this->formFactory = self::$container->get('form.factory');
$this->formFactory = $this->container->get('form.factory');
$token = (new UsernamePasswordToken($this->user, 'password', 'firewall'));
self::$container->get('security.token_storage')
$this->container->get('security.token_storage')
->setToken($token);
}

View File

@@ -8,7 +8,6 @@ services:
$configPersonAltNameHelper: '@Chill\PersonBundle\Config\ConfigPersonAltNamesHelper'
$logger: '@Psr\Log\LoggerInterface'
$validator: '@Symfony\Component\Validator\Validator\ValidatorInterface'
$em: '@Doctrine\ORM\EntityManagerInterface'
tags: ['controller.service_arguments']
Chill\PersonBundle\Controller\TimelinePersonController:

View File

@@ -1,86 +0,0 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\Migrations\Person;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Create Social action, Social Issue, Work Goal and Work Result.
*/
final class Version20210426145930 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_person_social_action DROP CONSTRAINT FK_B7ABFAB8727ACA70');
$this->addSql('ALTER TABLE chill_person_social_action_goal DROP CONSTRAINT FK_163CA4DD3DC32179');
$this->addSql('ALTER TABLE chill_person_social_action_result DROP CONSTRAINT FK_CA98C58C3DC32179');
$this->addSql('ALTER TABLE chill_person_social_action DROP CONSTRAINT FK_B7ABFAB85E7AA58C');
$this->addSql('ALTER TABLE chill_person_social_issue DROP CONSTRAINT FK_7A484DAE727ACA70');
$this->addSql('ALTER TABLE chill_person_social_action_goal DROP CONSTRAINT FK_163CA4DD667D1AFE');
$this->addSql('ALTER TABLE chill_person_social_work_goal_result DROP CONSTRAINT FK_F3BAEEA9667D1AFE');
$this->addSql('ALTER TABLE chill_person_social_action_result DROP CONSTRAINT FK_CA98C58C7A7B643');
$this->addSql('ALTER TABLE chill_person_social_work_goal_result DROP CONSTRAINT FK_F3BAEEA97A7B643');
$this->addSql('DROP SEQUENCE chill_person_social_action_id_seq CASCADE');
$this->addSql('DROP SEQUENCE chill_person_social_issue_id_seq CASCADE');
$this->addSql('DROP SEQUENCE chill_person_social_work_goal_id_seq CASCADE');
$this->addSql('DROP SEQUENCE chill_person_social_work_result_id_seq CASCADE');
$this->addSql('DROP TABLE chill_person_social_action');
$this->addSql('DROP TABLE chill_person_social_action_goal');
$this->addSql('DROP TABLE chill_person_social_action_result');
$this->addSql('DROP TABLE chill_person_social_issue');
$this->addSql('DROP TABLE chill_person_social_work_goal');
$this->addSql('DROP TABLE chill_person_social_work_goal_result');
$this->addSql('DROP TABLE chill_person_social_work_result');
}
public function getDescription(): string
{
return 'Create Social action, Social Issue, Work Goal and Work Result';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE SEQUENCE chill_person_social_action_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE chill_person_social_issue_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE chill_person_social_work_goal_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE chill_person_social_work_result_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE chill_person_social_action (id INT NOT NULL, issue_id INT DEFAULT NULL, parent_id INT DEFAULT NULL, desactivationDate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, defaultNotificationDelay INTERVAL NOT NULL, title JSONB NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_B7ABFAB85E7AA58C ON chill_person_social_action (issue_id)');
$this->addSql('CREATE INDEX IDX_B7ABFAB8727ACA70 ON chill_person_social_action (parent_id)');
$this->addSql('COMMENT ON COLUMN chill_person_social_action.defaultNotificationDelay IS \'(DC2Type:dateinterval)\'');
$this->addSql('CREATE TABLE chill_person_social_action_goal (socialaction_id INT NOT NULL, goal_id INT NOT NULL, PRIMARY KEY(socialaction_id, goal_id))');
$this->addSql('CREATE INDEX IDX_163CA4DD3DC32179 ON chill_person_social_action_goal (socialaction_id)');
$this->addSql('CREATE INDEX IDX_163CA4DD667D1AFE ON chill_person_social_action_goal (goal_id)');
$this->addSql('CREATE TABLE chill_person_social_action_result (socialaction_id INT NOT NULL, result_id INT NOT NULL, PRIMARY KEY(socialaction_id, result_id))');
$this->addSql('CREATE INDEX IDX_CA98C58C3DC32179 ON chill_person_social_action_result (socialaction_id)');
$this->addSql('CREATE INDEX IDX_CA98C58C7A7B643 ON chill_person_social_action_result (result_id)');
$this->addSql('CREATE TABLE chill_person_social_issue (id INT NOT NULL, parent_id INT DEFAULT NULL, desactivationDate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, title JSONB NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_7A484DAE727ACA70 ON chill_person_social_issue (parent_id)');
$this->addSql('CREATE TABLE chill_person_social_work_goal (id INT NOT NULL, title JSONB NOT NULL, desactivationDate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE chill_person_social_work_goal_result (goal_id INT NOT NULL, result_id INT NOT NULL, PRIMARY KEY(goal_id, result_id))');
$this->addSql('CREATE INDEX IDX_F3BAEEA9667D1AFE ON chill_person_social_work_goal_result (goal_id)');
$this->addSql('CREATE INDEX IDX_F3BAEEA97A7B643 ON chill_person_social_work_goal_result (result_id)');
$this->addSql('CREATE TABLE chill_person_social_work_result (id INT NOT NULL, title JSONB NOT NULL, desactivationDate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('ALTER TABLE chill_person_social_action ADD CONSTRAINT FK_B7ABFAB85E7AA58C FOREIGN KEY (issue_id) REFERENCES chill_person_social_issue (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_social_action ADD CONSTRAINT FK_B7ABFAB8727ACA70 FOREIGN KEY (parent_id) REFERENCES chill_person_social_action (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_social_action_goal ADD CONSTRAINT FK_163CA4DD3DC32179 FOREIGN KEY (socialaction_id) REFERENCES chill_person_social_action (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_social_action_goal ADD CONSTRAINT FK_163CA4DD667D1AFE FOREIGN KEY (goal_id) REFERENCES chill_person_social_work_goal (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_social_action_result ADD CONSTRAINT FK_CA98C58C3DC32179 FOREIGN KEY (socialaction_id) REFERENCES chill_person_social_action (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_social_action_result ADD CONSTRAINT FK_CA98C58C7A7B643 FOREIGN KEY (result_id) REFERENCES chill_person_social_work_result (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_social_issue ADD CONSTRAINT FK_7A484DAE727ACA70 FOREIGN KEY (parent_id) REFERENCES chill_person_social_issue (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_social_work_goal_result ADD CONSTRAINT FK_F3BAEEA9667D1AFE FOREIGN KEY (goal_id) REFERENCES chill_person_social_work_goal (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_social_work_goal_result ADD CONSTRAINT FK_F3BAEEA97A7B643 FOREIGN KEY (result_id) REFERENCES chill_person_social_work_result (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
}

View File

@@ -1,86 +0,0 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\Migrations\Person;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Create tables for the entites AccomanyingPeriodWork, AccomanyingPeriodWorkGoal & Social/WorkEvaluation.
*/
final class Version20210427125700 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_result DROP CONSTRAINT FK_46E95929B99F6060');
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_third_party DROP CONSTRAINT FK_83B57B86B99F6060');
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_goal DROP CONSTRAINT FK_911B88FEC55C1209');
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_goal_result DROP CONSTRAINT FK_3E37D1F37B14AD03');
$this->addSql('DROP SEQUENCE chill_person_accompanying_period_work_id_seq CASCADE');
$this->addSql('DROP SEQUENCE chill_person_accompanying_period_work_goal_id_seq CASCADE');
$this->addSql('DROP SEQUENCE chill_person_social_work_evaluation_id_seq CASCADE');
$this->addSql('DROP TABLE chill_person_accompanying_period_work');
$this->addSql('DROP TABLE chill_person_accompanying_period_work_result');
$this->addSql('DROP TABLE chill_person_accompanying_period_work_third_party');
$this->addSql('DROP TABLE chill_person_accompanying_period_work_goal');
$this->addSql('DROP TABLE chill_person_accompanying_period_work_goal_result');
$this->addSql('DROP TABLE chill_person_social_work_evaluation');
}
public function getDescription(): string
{
return 'Create tables for the entites AccomanyingPeriodWork, AccomanyingPeriodWorkGoal & Social/WorkEvaluation';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE SEQUENCE chill_person_accompanying_period_work_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE chill_person_accompanying_period_work_goal_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE chill_person_social_work_evaluation_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE chill_person_accompanying_period_work (id INT NOT NULL, note TEXT NOT NULL, createdAt TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, startDate TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, endDate TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, createdAutomatically BOOLEAN NOT NULL, createdAutomaticallyReason TEXT NOT NULL, accompanyingPeriod_id INT DEFAULT NULL, socialAction_id INT DEFAULT NULL, createdBy_id INT NOT NULL, handlingThierParty_id INT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_B694FB3D7FA8EF0 ON chill_person_accompanying_period_work (accompanyingPeriod_id)');
$this->addSql('CREATE INDEX IDX_B694FB3BF32A3DA ON chill_person_accompanying_period_work (socialAction_id)');
$this->addSql('CREATE INDEX IDX_B694FB33174800F ON chill_person_accompanying_period_work (createdBy_id)');
$this->addSql('CREATE INDEX IDX_B694FB382B35EA7 ON chill_person_accompanying_period_work (handlingThierParty_id)');
$this->addSql('CREATE TABLE chill_person_accompanying_period_work_result (accompanyingperiodwork_id INT NOT NULL, result_id INT NOT NULL, PRIMARY KEY(accompanyingperiodwork_id, result_id))');
$this->addSql('CREATE INDEX IDX_46E95929B99F6060 ON chill_person_accompanying_period_work_result (accompanyingperiodwork_id)');
$this->addSql('CREATE INDEX IDX_46E959297A7B643 ON chill_person_accompanying_period_work_result (result_id)');
$this->addSql('CREATE TABLE chill_person_accompanying_period_work_third_party (accompanyingperiodwork_id INT NOT NULL, thirdparty_id INT NOT NULL, PRIMARY KEY(accompanyingperiodwork_id, thirdparty_id))');
$this->addSql('CREATE INDEX IDX_83B57B86B99F6060 ON chill_person_accompanying_period_work_third_party (accompanyingperiodwork_id)');
$this->addSql('CREATE INDEX IDX_83B57B86C7D3A8E6 ON chill_person_accompanying_period_work_third_party (thirdparty_id)');
$this->addSql('CREATE TABLE chill_person_accompanying_period_work_goal (id INT NOT NULL, goal_id INT DEFAULT NULL, note TEXT NOT NULL, accompanyingPeriodWork_id INT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_911B88FEC55C1209 ON chill_person_accompanying_period_work_goal (accompanyingPeriodWork_id)');
$this->addSql('CREATE INDEX IDX_911B88FE667D1AFE ON chill_person_accompanying_period_work_goal (goal_id)');
$this->addSql('CREATE TABLE chill_person_accompanying_period_work_goal_result (accompanyingperiodworkgoal_id INT NOT NULL, result_id INT NOT NULL, PRIMARY KEY(accompanyingperiodworkgoal_id, result_id))');
$this->addSql('CREATE INDEX IDX_3E37D1F37B14AD03 ON chill_person_accompanying_period_work_goal_result (accompanyingperiodworkgoal_id)');
$this->addSql('CREATE INDEX IDX_3E37D1F37A7B643 ON chill_person_accompanying_period_work_goal_result (result_id)');
$this->addSql('CREATE TABLE chill_person_social_work_evaluation (id INT NOT NULL, title JSONB NOT NULL, delay INTERVAL NOT NULL, notificationDelay INTERVAL NOT NULL, socialAction_id INT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_2E23F3FEBF32A3DA ON chill_person_social_work_evaluation (socialAction_id)');
$this->addSql('COMMENT ON COLUMN chill_person_social_work_evaluation.delay IS \'(DC2Type:dateinterval)\'');
$this->addSql('COMMENT ON COLUMN chill_person_social_work_evaluation.notificationDelay IS \'(DC2Type:dateinterval)\'');
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ADD CONSTRAINT FK_B694FB3D7FA8EF0 FOREIGN KEY (accompanyingPeriod_id) REFERENCES chill_person_accompanying_period (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ADD CONSTRAINT FK_B694FB3BF32A3DA FOREIGN KEY (socialAction_id) REFERENCES chill_person_social_action (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ADD CONSTRAINT FK_B694FB33174800F FOREIGN KEY (createdBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ADD CONSTRAINT FK_B694FB382B35EA7 FOREIGN KEY (handlingThierParty_id) REFERENCES chill_3party.third_party (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_result ADD CONSTRAINT FK_46E95929B99F6060 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_result ADD CONSTRAINT FK_46E959297A7B643 FOREIGN KEY (result_id) REFERENCES chill_person_social_work_result (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_third_party ADD CONSTRAINT FK_83B57B86B99F6060 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_third_party ADD CONSTRAINT FK_83B57B86C7D3A8E6 FOREIGN KEY (thirdparty_id) REFERENCES chill_3party.third_party (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_goal ADD CONSTRAINT FK_911B88FEC55C1209 FOREIGN KEY (accompanyingPeriodWork_id) REFERENCES chill_person_accompanying_period_work (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_goal ADD CONSTRAINT FK_911B88FE667D1AFE FOREIGN KEY (goal_id) REFERENCES chill_person_social_work_goal (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_goal_result ADD CONSTRAINT FK_3E37D1F37B14AD03 FOREIGN KEY (accompanyingperiodworkgoal_id) REFERENCES chill_person_accompanying_period_work_goal (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_goal_result ADD CONSTRAINT FK_3E37D1F37A7B643 FOREIGN KEY (result_id) REFERENCES chill_person_social_work_result (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_person_social_work_evaluation ADD CONSTRAINT FK_2E23F3FEBF32A3DA FOREIGN KEY (socialAction_id) REFERENCES chill_person_social_action (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
}