Merge remote-tracking branch 'origin/fix-getParticipationsContainsPerson' into fix-person-tests

This commit is contained in:
2021-05-26 22:38:25 +02:00
84 changed files with 1954 additions and 668 deletions

View File

@@ -37,7 +37,7 @@ use Chill\MainBundle\Entity\User;
/**
* AccompanyingPeriod Class
*
* @ORM\Entity(repositoryClass="Chill\PersonBundle\Repository\AccompanyingPeriodRepository")
* @ORM\Entity
* @ORM\Table(name="chill_person_accompanying_period")
*/
class AccompanyingPeriod
@@ -344,12 +344,13 @@ class AccompanyingPeriod
*/
public function getParticipationsContainsPerson(Person $person): Collection
{
return $this->getParticipations($person)->filter(
function(AccompanyingPeriodParticipation $participation) use ($person) {
if ($person === $participation->getPerson()) {
return $participation;
return $this
->getParticipations()
->filter(
static function(AccompanyingPeriodParticipation $participation) use ($person): bool {
return $person === $participation->getPerson();
}
});
);
}
/**
@@ -359,12 +360,13 @@ class AccompanyingPeriod
*/
public function getOpenParticipationContainsPerson(Person $person): ?AccompanyingPeriodParticipation
{
$collection = $this->getParticipationsContainsPerson($person)->filter(
function(AccompanyingPeriodParticipation $participation) use ($person) {
if (NULL === $participation->getEndDate()) {
return $participation;
$collection = $this
->getParticipationsContainsPerson($person)
->filter(
static function(AccompanyingPeriodParticipation $participation): bool {
return null === $participation->getEndDate();
}
});
);
return $collection->count() > 0 ? $collection->first() : NULL;
}
@@ -429,15 +431,16 @@ class AccompanyingPeriod
return false;
}
$participation = $this->participationsContainsPerson($person);
if (!null === $participation)
$participation = $this->getOpenParticipationContainsPerson($person);
if (null === $participation)
{
$person = $participation->getPerson();
$periods = $person->getAccompanyingPeriodsOrdered();
return end($periods) === $this;
return false;
}
return false;
$periods = $participation->getPerson()->getAccompanyingPeriodsOrdered();
return end($periods) === $this;
}
/**
@@ -646,13 +649,17 @@ class AccompanyingPeriod
/**
* Get a list of all persons which are participating to this course
*
* @psalm-return Collection<int, Person>
*/
public function getPersons(): Collection
{
return $this->participations->map(
function(AccompanyingPeriodParticipation $participation) {
return $participation->getPerson();
}
);
return $this
->participations
->map(
static function(AccompanyingPeriodParticipation $participation): Person {
return $participation->getPerson();
}
);
}
}

View File

@@ -4,7 +4,6 @@ namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\SocialWork\Result;
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
@@ -13,7 +12,7 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=AccompanyingPeriodWorkRepository::class)
* @ORM\Entity
* @ORM\Table(name="chill_person_accompanying_period_work")
*/
class AccompanyingPeriodWork

View File

@@ -4,13 +4,12 @@ namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\SocialWork\Goal;
use Chill\PersonBundle\Entity\SocialWork\Result;
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkGoalRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=AccompanyingPeriodWorkGoalRepository::class)
* @ORM\Entity
* @ORM\Table(name="chill_person_accompanying_period_work_goal")
*/
class AccompanyingPeriodWorkGoal

View File

@@ -29,8 +29,7 @@ use Doctrine\Common\Collections\ArrayCollection;
/**
* ClosingMotive give an explanation why we closed the Accompanying period
*
* @ORM\Entity(
* repositoryClass="Chill\PersonBundle\Repository\AccompanyingPeriod\ClosingMotiveRepository")
* @ORM\Entity
* @ORM\Table(name="chill_person_accompanying_period_closingmotive")
*/
class ClosingMotive

View File

@@ -22,13 +22,12 @@
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Repository\AccompanyingPeriod\CommentRepository;
use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CommentRepository::class)
* @ORM\Entity
* @ORM\Table(name="chill_person_accompanying_period_comment")
*/
class Comment

View File

@@ -22,11 +22,10 @@
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Repository\AccompanyingPeriod\OriginRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=OriginRepository::class)
* @ORM\Entity
* @ORM\Table(name="chill_person_accompanying_period_origin")
*/
class Origin

View File

@@ -22,7 +22,6 @@
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Repository\AccompanyingPeriod\ResourceRepository;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
use Chill\PersonBundle\Entity\Person;
@@ -30,7 +29,7 @@ use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ResourceRepository::class)
* @ORM\Entity
* @ORM\Table(name="chill_person_accompanying_period_resource")
*/
class Resource

View File

@@ -22,7 +22,6 @@
namespace Chill\PersonBundle\Entity;
use Chill\PersonBundle\Repository\AccompanyingPeriodParticipationRepository;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
use Doctrine\ORM\Mapping as ORM;
@@ -31,7 +30,7 @@ use Doctrine\ORM\Mapping as ORM;
* AccompanyingPeriodParticipation Class
*
* @package Chill\PersonBundle\Entity
* @ORM\Entity(repositoryClass=AccompanyingPeriodParticipationRepository::class)
* @ORM\Entity
* @ORM\Table(name="chill_person_accompanying_period_participation")
*/
class AccompanyingPeriodParticipation

View File

@@ -2,13 +2,12 @@
namespace Chill\PersonBundle\Entity\Household;
use Chill\PersonBundle\Repository\Household\HouseholdRepository;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use Chill\MainBundle\Entity\Address;
/**
* @ORM\Entity(repositoryClass=HouseholdRepository::class)
* @ORM\Entity
*/
class Household
{

View File

@@ -3,12 +3,11 @@
namespace Chill\PersonBundle\Entity\Household;
use Doctrine\ORM\Mapping as ORM;
use Chill\PersonBundle\Repository\Household\HouseholdMembersRepository;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Entity\Household\Household;
/**
* @ORM\Entity(repositoryClass=HouseholdMembersRepository::class)
* @ORM\Entity
*/
class HouseholdMembers
{

View File

@@ -25,7 +25,7 @@ use Doctrine\ORM\Mapping as ORM;
/**
* MaritalStatus
*
* @ORM\Entity()
* @ORM\Entity
* @ORM\Table(name="chill_person_marital_status")
* @ORM\HasLifecycleCallbacks()
*/

View File

@@ -38,7 +38,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* Person Class
*
* @ORM\Entity(repositoryClass="Chill\PersonBundle\Repository\PersonRepository")
* @ORM\Entity
* @ORM\Table(name="chill_person_person",
* indexes={@ORM\Index(
* name="person_names",

View File

@@ -8,7 +8,7 @@ use Doctrine\ORM\Mapping as ORM;
* PersonAltName
*
* @ORM\Table(name="chill_person_alt_name")
* @ORM\Entity(repositoryClass="Chill\PersonBundle\Repository\PersonAltNameRepository")
* @ORM\Entity
*/
class PersonAltName
{

View File

@@ -9,7 +9,7 @@ use Chill\MainBundle\Entity\User;
* PersonNotDuplicate
*
* @ORM\Table(name="chill_person_not_duplicate")
* @ORM\Entity(repositoryClass="Chill\PersonBundle\Repository\PersonNotDuplicateRepository")
* @ORM\Entity
*/
class PersonNotDuplicate
{

View File

@@ -8,7 +8,7 @@ use Doctrine\ORM\Mapping as ORM;
/**
* Person Phones
*
* @ORM\Entity()
* @ORM\Entity
* @ORM\Table(name="chill_person_phone")
*/
class PersonPhone

View File

@@ -2,11 +2,10 @@
namespace Chill\PersonBundle\Entity\SocialWork;
use Chill\PersonBundle\Repository\SocialWork\EvaluationRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=EvaluationRepository::class)
* @ORM\Entity
* @ORM\Table(name="chill_person_social_work_evaluation")
*/
class Evaluation

View File

@@ -2,13 +2,12 @@
namespace Chill\PersonBundle\Entity\SocialWork;
use Chill\PersonBundle\Repository\SocialWork\GoalRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=GoalRepository::class)
* @ORM\Entity
* @ORM\Table(name="chill_person_social_work_goal")
*/
class Goal

View File

@@ -4,13 +4,12 @@ namespace Chill\PersonBundle\Entity\SocialWork;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkGoal;
use Chill\PersonBundle\Repository\SocialWork\ResultRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ResultRepository::class)
* @ORM\Entity
* @ORM\Table(name="chill_person_social_work_result")
*/
class Result

View File

@@ -2,13 +2,12 @@
namespace Chill\PersonBundle\Entity\SocialWork;
use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=SocialActionRepository::class)
* @ORM\Entity
* @ORM\Table(name="chill_person_social_action")
*/
class SocialAction

View File

@@ -1,14 +1,12 @@
<?php
namespace Chill\PersonBundle\Entity\SocialWork;
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=SocialIssueRepository::class)
* @ORM\Entity
* @ORM\Table(name="chill_person_social_issue")
*/
class SocialIssue