mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Transform join table between Person and AccompanyingPeriod in Doctrine entity
This commit is contained in:
@@ -77,9 +77,9 @@ class AccompanyingPeriod
|
||||
|
||||
/**
|
||||
* @var Collection
|
||||
* @ORM\ManyToMany(
|
||||
* targetEntity="Chill\PersonBundle\Entity\Person",
|
||||
* mappedBy="accompanyingPeriods")
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity=AccompanyingPeriodParticipation::class,
|
||||
* mappedBy="accompanyingPeriod")
|
||||
*/
|
||||
private $persons;
|
||||
|
||||
|
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* Copyright (C) 2021, Champs Libres Cooperative SCRLFS,
|
||||
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* AccompanyingPeriodParticipation Class
|
||||
*
|
||||
* @package Chill\PersonBundle\Entity
|
||||
* @ORM\Entity(repositoryClass=AccompanyingPeriodParticipationRepository::class)
|
||||
* @ORM\Table(name="chill_person_accompanying_period_participation")
|
||||
*/
|
||||
class AccompanyingPeriodParticipation
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Person::class,
|
||||
* inversedBy="accompanyingPeriods")
|
||||
* @ORM\JoinColumn(name="person_id", referencedColumnName="id", nullable=false)
|
||||
*/
|
||||
private $person;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class,
|
||||
* inversedBy="persons")
|
||||
* @ORM\JoinColumn(name="accompanyingperiod_id", referencedColumnName="id", nullable=false)
|
||||
*/
|
||||
private $accompanyingPeriod;
|
||||
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
@@ -42,7 +42,6 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
* name="person_names",
|
||||
* columns={"firstName", "lastName"}
|
||||
* )})
|
||||
* sf4 check index name
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
*/
|
||||
class Person implements HasCenterInterface
|
||||
@@ -204,17 +203,13 @@ class Person implements HasCenterInterface
|
||||
|
||||
/**
|
||||
* The person's accompanying periods (when the person was accompanied by the center)
|
||||
* @var ArrayCollection
|
||||
* @var Collection
|
||||
*
|
||||
* @ORM\ManyToMany(
|
||||
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod",
|
||||
* inversedBy="persons",
|
||||
* @ORM\OneToMany(targetEntity=AccompanyingPeriodParticipation::class,
|
||||
* mappedBy="person",
|
||||
* cascade={"persist", "remove", "merge", "detach"})
|
||||
* @ORM\JoinTable(
|
||||
* name="persons_accompanying_periods"
|
||||
* )
|
||||
*/
|
||||
private $accompanyingPeriods; //TO-CHANGE in accompanyingHistory
|
||||
private $accompanyingPeriods;
|
||||
|
||||
/**
|
||||
* A remark over the person
|
||||
|
Reference in New Issue
Block a user