mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
Merge branch 'sf4' of framagit.org:Chill-project/Chill-Person into sf4
This commit is contained in:
commit
6734295be7
@ -3,7 +3,7 @@
|
|||||||
namespace Chill\PersonBundle\Controller;
|
namespace Chill\PersonBundle\Controller;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
class AdminController extends Controller
|
class AdminController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,9 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
|||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
|
use Chill\MainBundle\Timeline\TimelineBuilder;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
|
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -38,14 +41,31 @@ class TimelinePersonController extends Controller
|
|||||||
*/
|
*/
|
||||||
protected $eventDispatcher;
|
protected $eventDispatcher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var TimelineBuilder
|
||||||
|
*/
|
||||||
|
protected $timelineBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var PaginatorFactory
|
||||||
|
*/
|
||||||
|
protected $paginatorFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TimelinePersonController constructor.
|
* TimelinePersonController constructor.
|
||||||
*
|
*
|
||||||
* @param EventDispatcherInterface $eventDispatcher
|
* @param EventDispatcherInterface $eventDispatcher
|
||||||
*/
|
*/
|
||||||
public function __construct(EventDispatcherInterface $eventDispatcher)
|
public function __construct(
|
||||||
{
|
EventDispatcherInterface $eventDispatcher,
|
||||||
|
TimelineBuilder $timelineBuilder,
|
||||||
|
PaginatorFactory $paginatorFactory
|
||||||
|
) {
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
|
$this->timelineBuilder = $timelineBuilder;
|
||||||
|
$this->paginatorFactory = $paginatorFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -59,24 +79,20 @@ class TimelinePersonController extends Controller
|
|||||||
throw $this->createNotFoundException();
|
throw $this->createNotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
|
||||||
|
|
||||||
/* @var $timelineBuilder \Chill\MainBundle\Timeline\TimelineBuilder */
|
$nbItems = $this->timelineBuilder->countItems('person',
|
||||||
$timelineBuilder = $this->get('chill.main.timeline_builder');
|
|
||||||
$paginatorFactory = $this->get('chill_main.paginator_factory');
|
|
||||||
|
|
||||||
$nbItems = $timelineBuilder->countItems('person',
|
|
||||||
[ 'person' => $person ]
|
[ 'person' => $person ]
|
||||||
);
|
);
|
||||||
|
|
||||||
$paginator = $paginatorFactory->create($nbItems);
|
$paginator = $this->paginatorFactory->create($nbItems);
|
||||||
|
|
||||||
$event = new PrivacyEvent($person, array('action' => 'timeline'));
|
$event = new PrivacyEvent($person, array('action' => 'timeline'));
|
||||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||||
|
|
||||||
return $this->render('ChillPersonBundle:Timeline:index.html.twig', array
|
return $this->render('ChillPersonBundle:Timeline:index.html.twig', array
|
||||||
(
|
(
|
||||||
'timeline' => $timelineBuilder->getTimelineHTML(
|
'timeline' => $this->timelineBuilder->getTimelineHTML(
|
||||||
'person',
|
'person',
|
||||||
array('person' => $person),
|
array('person' => $person),
|
||||||
$paginator->getCurrentPage()->getFirstItemNumber(),
|
$paginator->getCurrentPage()->getFirstItemNumber(),
|
||||||
|
@ -28,35 +28,73 @@ use Chill\MainBundle\Entity\User;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* AccompanyingPeriod
|
* AccompanyingPeriod
|
||||||
|
*
|
||||||
|
* @ORM\Entity()
|
||||||
|
* @ORM\Table(name="chill_person_accompanying_period")
|
||||||
*/
|
*/
|
||||||
class AccompanyingPeriod
|
class AccompanyingPeriod
|
||||||
{
|
{
|
||||||
/** @var integer */
|
/**
|
||||||
|
* @var integer
|
||||||
|
*
|
||||||
|
* @ORM\Id
|
||||||
|
* @ORM\Column(name="id", type="integer")
|
||||||
|
* @ORM\GeneratedValue(strategy="AUTO")
|
||||||
|
*/
|
||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
/** @var \DateTime */
|
/**
|
||||||
|
* @var \DateTime
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="date")
|
||||||
|
*/
|
||||||
private $openingDate;
|
private $openingDate;
|
||||||
|
|
||||||
/** @var \DateTime */
|
/**
|
||||||
private $closingDate;
|
* @var \DateTime
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="date", nullable=true)
|
||||||
|
*/
|
||||||
|
private $closingDate = null;
|
||||||
|
|
||||||
/** @var string */
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="text")
|
||||||
|
*/
|
||||||
private $remark = '';
|
private $remark = '';
|
||||||
|
|
||||||
/** @var \Chill\PersonBundle\Entity\Person */
|
/**
|
||||||
|
* @var Person
|
||||||
|
*
|
||||||
|
* @ORM\ManyToOne(
|
||||||
|
* targetEntity="Chill\PersonBundle\Entity\Person",
|
||||||
|
* inversedBy="accompanyingPeriods",
|
||||||
|
* cascade={"refresh"})
|
||||||
|
*/
|
||||||
private $person;
|
private $person;
|
||||||
|
|
||||||
/** @var AccompanyingPeriod\ClosingMotive */
|
/**
|
||||||
|
* @var AccompanyingPeriod\ClosingMotive
|
||||||
|
*
|
||||||
|
* @ORM\ManyToOne(
|
||||||
|
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive")
|
||||||
|
* @ORM\JoinColumn(nullable=true)
|
||||||
|
*/
|
||||||
private $closingMotive = null;
|
private $closingMotive = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The user making the accompanying
|
* The user making the accompanying
|
||||||
*
|
|
||||||
* @var User
|
* @var User
|
||||||
|
*
|
||||||
|
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
||||||
|
* @ORM\JoinColumn(nullable=true)
|
||||||
*/
|
*/
|
||||||
private $user;
|
private $user;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* AccompanyingPeriod constructor.
|
||||||
*
|
*
|
||||||
* @param \DateTime $dateOpening
|
* @param \DateTime $dateOpening
|
||||||
* @uses AccompanyingPeriod::setClosingDate()
|
* @uses AccompanyingPeriod::setClosingDate()
|
||||||
@ -125,7 +163,6 @@ class AccompanyingPeriod
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function isOpen(): bool
|
public function isOpen(): bool
|
||||||
@ -173,11 +210,11 @@ class AccompanyingPeriod
|
|||||||
*
|
*
|
||||||
* For consistency, you should use Person::addAccompanyingPeriod instead.
|
* For consistency, you should use Person::addAccompanyingPeriod instead.
|
||||||
*
|
*
|
||||||
* @param \Chill\PersonBundle\Entity\Person $person
|
* @param Person $person
|
||||||
* @return AccompanyingPeriod
|
* @return AccompanyingPeriod
|
||||||
* @see Person::addAccompanyingPeriod
|
* @see Person::addAccompanyingPeriod
|
||||||
*/
|
*/
|
||||||
public function setPerson(\Chill\PersonBundle\Entity\Person $person = null)
|
public function setPerson(Person $person = null)
|
||||||
{
|
{
|
||||||
$this->person = $person;
|
$this->person = $person;
|
||||||
|
|
||||||
@ -187,18 +224,25 @@ class AccompanyingPeriod
|
|||||||
/**
|
/**
|
||||||
* Get person
|
* Get person
|
||||||
*
|
*
|
||||||
* @return \Chill\PersonBundle\Entity\Person
|
* @return Person
|
||||||
*/
|
*/
|
||||||
public function getPerson()
|
public function getPerson()
|
||||||
{
|
{
|
||||||
return $this->person;
|
return $this->person;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return AccompanyingPeriod\ClosingMotive
|
||||||
|
*/
|
||||||
public function getClosingMotive()
|
public function getClosingMotive()
|
||||||
{
|
{
|
||||||
return $this->closingMotive;
|
return $this->closingMotive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param AccompanyingPeriod\ClosingMotive|null $closingMotive
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
public function setClosingMotive(AccompanyingPeriod\ClosingMotive $closingMotive = null)
|
public function setClosingMotive(AccompanyingPeriod\ClosingMotive $closingMotive = null)
|
||||||
{
|
{
|
||||||
$this->closingMotive = $closingMotive;
|
$this->closingMotive = $closingMotive;
|
||||||
@ -224,14 +268,19 @@ class AccompanyingPeriod
|
|||||||
return end($periods) === $this;
|
return end($periods) === $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
public function reOpen()
|
public function reOpen()
|
||||||
{
|
{
|
||||||
$this->setClosingDate(null);
|
$this->setClosingDate(null);
|
||||||
$this->setClosingMotive(null);
|
$this->setClosingMotive(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// VALIDATION function
|
/**
|
||||||
public function isDateConsistent(ExecutionContextInterface $context) {
|
* Validation function
|
||||||
|
*/
|
||||||
|
public function isDateConsistent(ExecutionContextInterface $context)
|
||||||
|
{
|
||||||
if ($this->isOpen()) {
|
if ($this->isOpen()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -248,7 +297,8 @@ class AccompanyingPeriod
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function isClosingAfterOpening() {
|
public function isClosingAfterOpening()
|
||||||
|
{
|
||||||
$diff = $this->getOpeningDate()->diff($this->getClosingDate());
|
$diff = $this->getOpeningDate()->diff($this->getClosingDate());
|
||||||
|
|
||||||
if ($diff->invert === 0) {
|
if ($diff->invert === 0) {
|
||||||
@ -258,11 +308,18 @@ class AccompanyingPeriod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return User|null
|
||||||
|
*/
|
||||||
function getUser(): ?User
|
function getUser(): ?User
|
||||||
{
|
{
|
||||||
return $this->user;
|
return $this->user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param User $user
|
||||||
|
* @return AccompanyingPeriod
|
||||||
|
*/
|
||||||
function setUser(User $user): self
|
function setUser(User $user): self
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
@ -270,5 +327,4 @@ class AccompanyingPeriod
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,51 +20,75 @@
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClosingMotive give an explanation why we closed the Accompanying period
|
* ClosingMotive give an explanation why we closed the Accompanying period
|
||||||
|
*
|
||||||
|
* @ORM\Entity(
|
||||||
|
* repositoryClass="Chill\PersonBundle\Repository\ClosingMotiveRepository")
|
||||||
|
* @ORM\Table(name="chill_person_closingmotive")
|
||||||
*/
|
*/
|
||||||
class ClosingMotive
|
class ClosingMotive
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var integer
|
* @var integer
|
||||||
|
*
|
||||||
|
* @ORM\Id
|
||||||
|
* @ORM\Column(name="id", type="integer")
|
||||||
|
* @ORM\GeneratedValue(strategy="AUTO")
|
||||||
*/
|
*/
|
||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="json_array")
|
||||||
*/
|
*/
|
||||||
private $name;
|
private $name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var boolean
|
* @var boolean
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="boolean")
|
||||||
*/
|
*/
|
||||||
private $active = true;
|
private $active = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var self
|
* @var self
|
||||||
|
*
|
||||||
|
* @ORM\ManyToOne(
|
||||||
|
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive",
|
||||||
|
* inversedBy="children")
|
||||||
*/
|
*/
|
||||||
private $parent = null;
|
private $parent = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* child Accompanying periods
|
* Child Accompanying periods
|
||||||
*
|
|
||||||
* @var Collection
|
* @var Collection
|
||||||
|
*
|
||||||
|
* @ORM\OneToMany(
|
||||||
|
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive",
|
||||||
|
* mappedBy="parent")
|
||||||
*/
|
*/
|
||||||
private $children;
|
private $children;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var float
|
* @var float
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="float")
|
||||||
*/
|
*/
|
||||||
private $ordering = 0.0;
|
private $ordering = 0.0;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClosingMotive constructor.
|
||||||
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->children = new \Doctrine\Common\Collections\ArrayCollection();
|
$this->children = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -101,11 +125,18 @@ class ClosingMotive
|
|||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function isActive(): bool
|
public function isActive(): bool
|
||||||
{
|
{
|
||||||
return $this->active;
|
return $this->active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $active
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
public function setActive(bool $active)
|
public function setActive(bool $active)
|
||||||
{
|
{
|
||||||
$this->active = $active;
|
$this->active = $active;
|
||||||
@ -119,16 +150,26 @@ class ClosingMotive
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ClosingMotive
|
||||||
|
*/
|
||||||
public function getParent()
|
public function getParent()
|
||||||
{
|
{
|
||||||
return $this->parent;
|
return $this->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
public function getChildren(): Collection
|
public function getChildren(): Collection
|
||||||
{
|
{
|
||||||
return $this->children;
|
return $this->children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ClosingMotive|null $parent
|
||||||
|
* @return ClosingMotive
|
||||||
|
*/
|
||||||
public function setParent(?ClosingMotive $parent): ClosingMotive
|
public function setParent(?ClosingMotive $parent): ClosingMotive
|
||||||
{
|
{
|
||||||
$this->parent = $parent;
|
$this->parent = $parent;
|
||||||
@ -140,6 +181,10 @@ class ClosingMotive
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $children
|
||||||
|
* @return ClosingMotive
|
||||||
|
*/
|
||||||
public function setChildren(Collection $children): ClosingMotive
|
public function setChildren(Collection $children): ClosingMotive
|
||||||
{
|
{
|
||||||
$this->children = $children;
|
$this->children = $children;
|
||||||
@ -147,6 +192,10 @@ class ClosingMotive
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ClosingMotive $child
|
||||||
|
* @return ClosingMotive
|
||||||
|
*/
|
||||||
public function addChildren(ClosingMotive $child): ClosingMotive
|
public function addChildren(ClosingMotive $child): ClosingMotive
|
||||||
{
|
{
|
||||||
if ($this->children->contains($child)) {
|
if ($this->children->contains($child)) {
|
||||||
@ -159,6 +208,10 @@ class ClosingMotive
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ClosingMotive $child
|
||||||
|
* @return ClosingMotive
|
||||||
|
*/
|
||||||
public function removeChildren(ClosingMotive $child): ClosingMotive
|
public function removeChildren(ClosingMotive $child): ClosingMotive
|
||||||
{
|
{
|
||||||
if ($this->children->removeElement($child)) {
|
if ($this->children->removeElement($child)) {
|
||||||
@ -168,11 +221,18 @@ class ClosingMotive
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
public function getOrdering(): float
|
public function getOrdering(): float
|
||||||
{
|
{
|
||||||
return $this->ordering;
|
return $this->ordering;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param float $ordering
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
public function setOrdering(float $ordering)
|
public function setOrdering(float $ordering)
|
||||||
{
|
{
|
||||||
$this->ordering = $ordering;
|
$this->ordering = $ordering;
|
||||||
@ -180,21 +240,33 @@ class ClosingMotive
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function isChild(): bool
|
public function isChild(): bool
|
||||||
{
|
{
|
||||||
return $this->parent !== null;
|
return $this->parent !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function isParent(): bool
|
public function isParent(): bool
|
||||||
{
|
{
|
||||||
return $this->children->count() > 0;
|
return $this->children->count() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function isLeaf(): bool
|
public function isLeaf(): bool
|
||||||
{
|
{
|
||||||
return $this->children->count() === 0;
|
return $this->children->count() === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function hasParent(): bool
|
public function hasParent(): bool
|
||||||
{
|
{
|
||||||
return $this->parent !== null;
|
return $this->parent !== null;
|
||||||
|
@ -20,18 +20,28 @@
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\Entity;
|
namespace Chill\PersonBundle\Entity;
|
||||||
|
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MaritalStatus
|
* MaritalStatus
|
||||||
|
*
|
||||||
|
* @ORM\Entity()
|
||||||
|
* @ORM\Table(name="chill_person_marital_status")
|
||||||
|
* @ORM\HasLifecycleCallbacks()
|
||||||
*/
|
*/
|
||||||
class MaritalStatus
|
class MaritalStatus
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
|
*
|
||||||
|
* @ORM\Id()
|
||||||
|
* @ORM\Column(type="string", length=7)
|
||||||
*/
|
*/
|
||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string array
|
* @var string array
|
||||||
|
* @ORM\Column(type="json_array")
|
||||||
*/
|
*/
|
||||||
private $name;
|
private $name;
|
||||||
|
|
||||||
|
@ -22,110 +22,248 @@ namespace Chill\PersonBundle\Entity;
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\Common\Collections\Criteria;
|
||||||
|
use Chill\MainBundle\Entity\Center;
|
||||||
use Chill\MainBundle\Entity\Country;
|
use Chill\MainBundle\Entity\Country;
|
||||||
use Chill\PersonBundle\Entity\MaritalStatus;
|
use Chill\PersonBundle\Entity\MaritalStatus;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
|
||||||
use Chill\MainBundle\Entity\HasCenterInterface;
|
use Chill\MainBundle\Entity\HasCenterInterface;
|
||||||
use Chill\MainBundle\Entity\Address;
|
use Chill\MainBundle\Entity\Address;
|
||||||
use Doctrine\Common\Collections\Criteria;
|
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Person
|
* Person Class
|
||||||
|
*
|
||||||
|
* @ORM\Entity(repositoryClass="Chill\PersonBundle\Repository\PersonRepository")
|
||||||
|
* @ORM\Table(name="chill_person_person",
|
||||||
|
* indexes={@ORM\Index(
|
||||||
|
* name="person_names",
|
||||||
|
* columns={"firstName", "lastName"}
|
||||||
|
* )})
|
||||||
|
* sf4 check index name
|
||||||
|
* @ORM\HasLifecycleCallbacks()
|
||||||
|
*/
|
||||||
|
class Person implements HasCenterInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The person's id
|
||||||
|
* @var integer
|
||||||
|
*
|
||||||
|
* @ORM\Id
|
||||||
|
* @ORM\Column(name="id", type="integer")
|
||||||
|
* @ORM\GeneratedValue(strategy="AUTO")
|
||||||
*/
|
*/
|
||||||
class Person implements HasCenterInterface {
|
|
||||||
/** @var integer The person's id */
|
|
||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
/** @var string The person's first name */
|
/**
|
||||||
|
* The person's first name
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="string", length=255)
|
||||||
|
*/
|
||||||
private $firstName;
|
private $firstName;
|
||||||
|
|
||||||
/** @var string The person's last name */
|
/**
|
||||||
|
* The person's last name
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="string", length=255)
|
||||||
|
*/
|
||||||
private $lastName;
|
private $lastName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @var Collection
|
||||||
*
|
*
|
||||||
* @var \Doctrine\Common\Collections\Collection
|
* @ORM\OneToMany(
|
||||||
|
* targetEntity="Chill\PersonBundle\Entity\PersonAltName",
|
||||||
|
* mappedBy="person",
|
||||||
|
* cascade={"persist", "remove", "merge", "detach"},
|
||||||
|
* orphanRemoval=true)
|
||||||
*/
|
*/
|
||||||
private $altNames;
|
private $altNames;
|
||||||
|
|
||||||
/** @var \DateTime The person's birthdate */
|
/**
|
||||||
|
* The person's birthdate
|
||||||
|
* @var \DateTime
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="date", nullable=true)
|
||||||
|
*/
|
||||||
private $birthdate; //to change in birthdate
|
private $birthdate; //to change in birthdate
|
||||||
|
|
||||||
/** @var string The person's place of birth */
|
/**
|
||||||
|
* The person's place of birth
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="string", length=255, name="place_of_birth")
|
||||||
|
*/
|
||||||
private $placeOfBirth = '';
|
private $placeOfBirth = '';
|
||||||
|
|
||||||
/** @var \Chill\MainBundle\Entity\Country The person's country of birth */
|
/**
|
||||||
|
* The person's country of birth
|
||||||
|
* @var Country
|
||||||
|
*
|
||||||
|
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Country")
|
||||||
|
*
|
||||||
|
* sf4 check: option inversedBy="birthsIn" return error mapping !!
|
||||||
|
*
|
||||||
|
* @ORM\JoinColumn(nullable=true)
|
||||||
|
*/
|
||||||
private $countryOfBirth;
|
private $countryOfBirth;
|
||||||
|
|
||||||
/** @var \Chill\MainBundle\Entity\Country The person's nationality */
|
/**
|
||||||
|
* The person's nationality
|
||||||
|
* @var Country
|
||||||
|
*
|
||||||
|
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Country")
|
||||||
|
*
|
||||||
|
* sf4 check: option inversedBy="nationals" return error mapping !!
|
||||||
|
*
|
||||||
|
* @ORM\JoinColumn(nullable=true)
|
||||||
|
*/
|
||||||
private $nationality;
|
private $nationality;
|
||||||
|
|
||||||
/** @var string The person's gender */
|
/**
|
||||||
|
* The person's gender
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="string", length=9, nullable=true)
|
||||||
|
*/
|
||||||
private $gender;
|
private $gender;
|
||||||
|
|
||||||
const MALE_GENDER = 'man';
|
const MALE_GENDER = 'man';
|
||||||
const FEMALE_GENDER = 'woman';
|
const FEMALE_GENDER = 'woman';
|
||||||
const BOTH_GENDER = 'both';
|
const BOTH_GENDER = 'both';
|
||||||
|
|
||||||
/** @var \Chill\PersonBundle\Entity\MaritalStatus The marital status of the person */
|
/**
|
||||||
|
* The marital status of the person
|
||||||
|
* @var MaritalStatus
|
||||||
|
*
|
||||||
|
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\MaritalStatus")
|
||||||
|
* @ORM\JoinColumn(nullable=true)
|
||||||
|
*/
|
||||||
private $maritalStatus;
|
private $maritalStatus;
|
||||||
|
|
||||||
/** @var string Contact information for contacting the person */
|
/**
|
||||||
|
* Contact information for contacting the person
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="text", nullable=true)
|
||||||
|
*/
|
||||||
private $contactInfo = '';
|
private $contactInfo = '';
|
||||||
|
|
||||||
/** @var string The person's email */
|
/**
|
||||||
|
* The person's email
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="text", nullable=true)
|
||||||
|
*/
|
||||||
private $email = '';
|
private $email = '';
|
||||||
|
|
||||||
/** @var string The person's phonenumber */
|
/**
|
||||||
|
* The person's phonenumber
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="text", length=40, nullable=true)
|
||||||
|
*/
|
||||||
private $phonenumber = '';
|
private $phonenumber = '';
|
||||||
|
|
||||||
/** @var string The person's mobile phone number */
|
/**
|
||||||
|
* The person's mobile phone number
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="text", length=40, nullable=true)
|
||||||
|
*/
|
||||||
private $mobilenumber = '';
|
private $mobilenumber = '';
|
||||||
|
|
||||||
//TO-ADD : caseOpeningDate
|
//TO-ADD caseOpeningDate
|
||||||
|
|
||||||
//TO-ADD nativeLanguag
|
//TO-ADD nativeLanguag
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \Doctrine\Common\Collections\ArrayCollection The person's spoken
|
* The person's spoken languages
|
||||||
* languages (ArrayCollection of Languages)
|
* @var ArrayCollection
|
||||||
|
*
|
||||||
|
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\Language")
|
||||||
|
* @ORM\JoinTable(
|
||||||
|
* name="persons_spoken_languages",
|
||||||
|
* joinColumns={@ORM\JoinColumn(name="person_id", referencedColumnName="id")},
|
||||||
|
* inverseJoinColumns={@ORM\JoinColumn(name="language_id", referencedColumnName="id")}
|
||||||
|
* )
|
||||||
*/
|
*/
|
||||||
private $spokenLanguages;
|
private $spokenLanguages;
|
||||||
|
|
||||||
/** @var \Chill\MainBundle\Entity\Center The person's center */
|
/**
|
||||||
|
* The person's center
|
||||||
|
* @var Center
|
||||||
|
*
|
||||||
|
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center")
|
||||||
|
* @ORM\JoinColumn(nullable=false)
|
||||||
|
*/
|
||||||
private $center;
|
private $center;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \Doctrine\Common\Collections\ArrayCollection The person's
|
* The person's accompanying periods (when the person was accompanied by the center)
|
||||||
* accompanying periods (when the person was accompanied by the center)*/
|
* @var ArrayCollection
|
||||||
|
*
|
||||||
|
* @ORM\OneToMany(
|
||||||
|
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod",
|
||||||
|
* mappedBy="person",
|
||||||
|
* cascade={"persist", "remove", "merge", "detach"})
|
||||||
|
*/
|
||||||
private $accompanyingPeriods; //TO-CHANGE in accompanyingHistory
|
private $accompanyingPeriods; //TO-CHANGE in accompanyingHistory
|
||||||
|
|
||||||
/** @var string A remark over the person */
|
/**
|
||||||
|
* A remark over the person
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="text")
|
||||||
|
*/
|
||||||
private $memo = ''; // TO-CHANGE in remark
|
private $memo = ''; // TO-CHANGE in remark
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var boolean
|
* @var boolean
|
||||||
* @deprecated
|
* @deprecated
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="boolean")
|
||||||
*/
|
*/
|
||||||
private $proxyAccompanyingPeriodOpenState = false; //TO-DELETE ?
|
private $proxyAccompanyingPeriodOpenState = false; //TO-DELETE ?
|
||||||
|
|
||||||
|
/**
|
||||||
/** @var array Array where customfield's data are stored */
|
* Array where customfield's data are stored
|
||||||
|
* @var array
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="json_array")
|
||||||
|
*/
|
||||||
private $cFData;
|
private $cFData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Addresses
|
||||||
|
* @var Collection
|
||||||
*
|
*
|
||||||
* @var \Doctrine\Common\Collections\Collection
|
* @ORM\ManyToMany(
|
||||||
|
* targetEntity="Chill\MainBundle\Entity\Address",
|
||||||
|
* cascade={"persist", "remove", "merge", "detach"})
|
||||||
|
* @ORM\JoinTable(name="chill_person_persons_to_addresses")
|
||||||
|
* @ORM\OrderBy({"validFrom" = "DESC"})
|
||||||
*/
|
*/
|
||||||
private $addresses;
|
private $addresses;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
|
*
|
||||||
|
* @ORM\Column(type="text", nullable=true)
|
||||||
*/
|
*/
|
||||||
private $fullnameCanonical;
|
private $fullnameCanonical;
|
||||||
|
|
||||||
public function __construct(\DateTime $opening = null) {
|
|
||||||
|
/**
|
||||||
|
* Person constructor.
|
||||||
|
*
|
||||||
|
* @param \DateTime|null $opening
|
||||||
|
*/
|
||||||
|
public function __construct(\DateTime $opening = null)
|
||||||
|
{
|
||||||
$this->accompanyingPeriods = new ArrayCollection();
|
$this->accompanyingPeriods = new ArrayCollection();
|
||||||
$this->spokenLanguages = new ArrayCollection();
|
$this->spokenLanguages = new ArrayCollection();
|
||||||
$this->addresses = new ArrayCollection();
|
$this->addresses = new ArrayCollection();
|
||||||
@ -139,15 +277,20 @@ class Person implements HasCenterInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Chill\PersonBundle\Entity\AccompanyingPeriod $accompanyingPeriod
|
* @param AccompanyingPeriod $accompanyingPeriod
|
||||||
* @uses AccompanyingPeriod::setPerson
|
* @uses AccompanyingPeriod::setPerson
|
||||||
*/
|
*/
|
||||||
public function addAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod) {
|
public function addAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod)
|
||||||
|
{
|
||||||
$accompanyingPeriod->setPerson($this);
|
$accompanyingPeriod->setPerson($this);
|
||||||
$this->accompanyingPeriods->add($accompanyingPeriod);
|
$this->accompanyingPeriods->add($accompanyingPeriod);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod) {
|
/**
|
||||||
|
* @param AccompanyingPeriod $accompanyingPeriod
|
||||||
|
*/
|
||||||
|
public function removeAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod)
|
||||||
|
{
|
||||||
$this->accompanyingPeriods->remove($accompanyingPeriod);
|
$this->accompanyingPeriods->remove($accompanyingPeriod);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,15 +304,15 @@ class Person implements HasCenterInterface {
|
|||||||
*
|
*
|
||||||
* To check if the Person and its accompanying period is consistent, use validation.
|
* To check if the Person and its accompanying period is consistent, use validation.
|
||||||
*
|
*
|
||||||
* @param \Chill\PersonBundle\Entity\AccompanyingPeriod $accompanyingPeriod
|
* @param AccompanyingPeriod $accompanyingPeriod
|
||||||
*/
|
*/
|
||||||
public function open(AccompanyingPeriod $accompanyingPeriod) {
|
public function open(AccompanyingPeriod $accompanyingPeriod)
|
||||||
|
{
|
||||||
$this->proxyAccompanyingPeriodOpenState = true;
|
$this->proxyAccompanyingPeriodOpenState = true;
|
||||||
$this->addAccompanyingPeriod($accompanyingPeriod);
|
$this->addAccompanyingPeriod($accompanyingPeriod);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Set the Person file as closed at the given date.
|
* Set the Person file as closed at the given date.
|
||||||
*
|
*
|
||||||
* For update a closing date, you should update AccompanyingPeriod instance
|
* For update a closing date, you should update AccompanyingPeriod instance
|
||||||
@ -190,7 +333,8 @@ class Person implements HasCenterInterface {
|
|||||||
*
|
*
|
||||||
* @return AccompanyingPeriod
|
* @return AccompanyingPeriod
|
||||||
*/
|
*/
|
||||||
public function getOpenedAccompanyingPeriod() {
|
public function getOpenedAccompanyingPeriod()
|
||||||
|
{
|
||||||
if ($this->isOpen() === false) {
|
if ($this->isOpen() === false) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -214,10 +358,10 @@ class Person implements HasCenterInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @return ArrayCollection
|
||||||
* @return \Doctrine\Common\Collections\ArrayCollection
|
|
||||||
*/
|
*/
|
||||||
public function getAccompanyingPeriods() {
|
public function getAccompanyingPeriods()
|
||||||
|
{
|
||||||
return $this->accompanyingPeriods;
|
return $this->accompanyingPeriods;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +371,8 @@ class Person implements HasCenterInterface {
|
|||||||
*
|
*
|
||||||
* @return AccompanyingPeriod[]
|
* @return AccompanyingPeriod[]
|
||||||
*/
|
*/
|
||||||
public function getAccompanyingPeriodsOrdered() {
|
public function getAccompanyingPeriodsOrdered()
|
||||||
|
{
|
||||||
$periods = $this->getAccompanyingPeriods()->toArray();
|
$periods = $this->getAccompanyingPeriods()->toArray();
|
||||||
|
|
||||||
//order by date :
|
//order by date :
|
||||||
@ -332,18 +477,29 @@ class Person implements HasCenterInterface {
|
|||||||
return $this->lastName;
|
return $this->lastName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAltNames(): \Doctrine\Common\Collections\Collection
|
/**
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function getAltNames(): Collection
|
||||||
{
|
{
|
||||||
return $this->altNames;
|
return $this->altNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setAltNames(\Doctrine\Common\Collections\Collection $altNames)
|
/**
|
||||||
|
* @param Collection $altNames
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setAltNames(Collection $altNames)
|
||||||
{
|
{
|
||||||
$this->altNames = $altNames;
|
$this->altNames = $altNames;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PersonAltName $altName
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
public function addAltName(PersonAltName $altName)
|
public function addAltName(PersonAltName $altName)
|
||||||
{
|
{
|
||||||
if (FALSE === $this->altNames->contains($altName)) {
|
if (FALSE === $this->altNames->contains($altName)) {
|
||||||
@ -354,6 +510,10 @@ class Person implements HasCenterInterface {
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PersonAltName $altName
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
public function removeAltName(PersonAltName $altName)
|
public function removeAltName(PersonAltName $altName)
|
||||||
{
|
{
|
||||||
if ($this->altNames->contains($altName)) {
|
if ($this->altNames->contains($altName)) {
|
||||||
@ -387,7 +547,6 @@ class Person implements HasCenterInterface {
|
|||||||
return $this->birthdate;
|
return $this->birthdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set placeOfBirth
|
* Set placeOfBirth
|
||||||
*
|
*
|
||||||
@ -443,7 +602,8 @@ class Person implements HasCenterInterface {
|
|||||||
* This is used for translations
|
* This is used for translations
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getGenderNumeric() {
|
public function getGenderNumeric()
|
||||||
|
{
|
||||||
if ($this->getGender() == self::FEMALE_GENDER) {
|
if ($this->getGender() == self::FEMALE_GENDER) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
@ -483,7 +643,7 @@ class Person implements HasCenterInterface {
|
|||||||
/**
|
/**
|
||||||
* Set maritalStatus
|
* Set maritalStatus
|
||||||
*
|
*
|
||||||
* @param \Chill\PersonBundle\Entity\MaritalStatus $maritalStatus
|
* @param MaritalStatus $maritalStatus
|
||||||
* @return Person
|
* @return Person
|
||||||
*/
|
*/
|
||||||
public function setMaritalStatus(MaritalStatus $maritalStatus = null)
|
public function setMaritalStatus(MaritalStatus $maritalStatus = null)
|
||||||
@ -495,7 +655,7 @@ class Person implements HasCenterInterface {
|
|||||||
/**
|
/**
|
||||||
* Get maritalStatus
|
* Get maritalStatus
|
||||||
*
|
*
|
||||||
* @return \Chill\PersonBundle\Entity\MaritalStatus
|
* @return MaritalStatus
|
||||||
*/
|
*/
|
||||||
public function getMaritalStatus()
|
public function getMaritalStatus()
|
||||||
{
|
{
|
||||||
@ -601,14 +761,18 @@ class Person implements HasCenterInterface {
|
|||||||
return $this->nationality;
|
return $this->nationality;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabel() {
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLabel()
|
||||||
|
{
|
||||||
return $this->getFirstName()." ".$this->getLastName();
|
return $this->getFirstName()." ".$this->getLastName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get center
|
* Get center
|
||||||
*
|
*
|
||||||
* @return \Chill\MainBundle\Entity\Center
|
* @return Center
|
||||||
*/
|
*/
|
||||||
public function getCenter()
|
public function getCenter()
|
||||||
{
|
{
|
||||||
@ -618,16 +782,15 @@ class Person implements HasCenterInterface {
|
|||||||
/**
|
/**
|
||||||
* Set the center
|
* Set the center
|
||||||
*
|
*
|
||||||
* @param \Chill\MainBundle\Entity\Center $center
|
* @param Center $center
|
||||||
* @return \Chill\PersonBundle\Entity\Person
|
* @return \Chill\PersonBundle\Entity\Person
|
||||||
*/
|
*/
|
||||||
public function setCenter(\Chill\MainBundle\Entity\Center $center)
|
public function setCenter(Center $center)
|
||||||
{
|
{
|
||||||
$this->center = $center;
|
$this->center = $center;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set cFData
|
* Set cFData
|
||||||
*
|
*
|
||||||
@ -701,6 +864,9 @@ class Person implements HasCenterInterface {
|
|||||||
return $this->mobilenumber;
|
return $this->mobilenumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function __toString()
|
public function __toString()
|
||||||
{
|
{
|
||||||
return $this->getLabel();
|
return $this->getLabel();
|
||||||
@ -729,6 +895,10 @@ class Person implements HasCenterInterface {
|
|||||||
return $this->spokenLanguages;
|
return $this->spokenLanguages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Address $address
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
public function addAddress(Address $address)
|
public function addAddress(Address $address)
|
||||||
{
|
{
|
||||||
$this->addresses[] = $address;
|
$this->addresses[] = $address;
|
||||||
@ -736,6 +906,9 @@ class Person implements HasCenterInterface {
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Address $address
|
||||||
|
*/
|
||||||
public function removeAddress(Address $address)
|
public function removeAddress(Address $address)
|
||||||
{
|
{
|
||||||
$this->addresses->removeElement($address);
|
$this->addresses->removeElement($address);
|
||||||
@ -752,6 +925,10 @@ class Person implements HasCenterInterface {
|
|||||||
return $this->addresses;
|
return $this->addresses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param \DateTime|null $date
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
public function getLastAddress(\DateTime $date = null)
|
public function getLastAddress(\DateTime $date = null)
|
||||||
{
|
{
|
||||||
if ($date === null) {
|
if ($date === null) {
|
||||||
|
@ -7,13 +7,13 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
/**
|
/**
|
||||||
* PersonAltName
|
* PersonAltName
|
||||||
*
|
*
|
||||||
* @ORM\Table(name="person_alt_name")
|
* @ORM\Table(name="chill_person_alt_name")
|
||||||
* @ORM\Entity(repositoryClass="Chill\PersonBundle\Repository\PersonAltNameRepository")
|
* @ORM\Entity(repositoryClass="Chill\PersonBundle\Repository\PersonAltNameRepository")
|
||||||
*/
|
*/
|
||||||
class PersonAltName
|
class PersonAltName
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var integer
|
||||||
*
|
*
|
||||||
* @ORM\Column(name="id", type="integer")
|
* @ORM\Column(name="id", type="integer")
|
||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
@ -36,11 +36,11 @@ class PersonAltName
|
|||||||
private $label;
|
private $label;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var Person
|
* @var Person
|
||||||
* @ORM\OneToMany(
|
*
|
||||||
|
* @ORM\ManyToOne(
|
||||||
* targetEntity="Chill\PersonBundle\Entity\Person",
|
* targetEntity="Chill\PersonBundle\Entity\Person",
|
||||||
* mappedBy="altNames"
|
* inversedBy="altNames"
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
private $person;
|
private $person;
|
||||||
@ -104,11 +104,18 @@ class PersonAltName
|
|||||||
return $this->label;
|
return $this->label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Person
|
||||||
|
*/
|
||||||
public function getPerson(): Person
|
public function getPerson(): Person
|
||||||
{
|
{
|
||||||
return $this->person;
|
return $this->person;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Person|null $person
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
public function setPerson(?Person $person = null)
|
public function setPerson(?Person $person = null)
|
||||||
{
|
{
|
||||||
$this->person = $person;
|
$this->person = $person;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 Champs-Libres <info@champs-libres.coop>
|
* Copyright (C) 2018 Champs-Libres <info@champs-libres.coop>
|
||||||
*
|
*
|
||||||
@ -15,31 +16,43 @@
|
|||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Chill\PersonBundle\Form\ChoiceLoader;
|
namespace Chill\PersonBundle\Form\ChoiceLoader;
|
||||||
|
|
||||||
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
|
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
|
||||||
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
|
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Symfony\Component\Form\ChoiceList\LazyChoiceList;
|
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Class PersonChoiceLoader
|
||||||
*
|
*
|
||||||
*
|
* @package Chill\PersonBundle\Form\ChoiceLoader
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
*/
|
*/
|
||||||
class PersonChoiceLoader implements ChoiceLoaderInterface
|
class PersonChoiceLoader implements ChoiceLoaderInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var EntityRepository
|
* @var EntityRepository
|
||||||
*/
|
*/
|
||||||
protected $personRepository;
|
protected $personRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
protected $lazyLoadedPersons = [];
|
protected $lazyLoadedPersons = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
protected $centers = [];
|
protected $centers = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PersonChoiceLoader constructor.
|
||||||
|
*
|
||||||
|
* @param EntityRepository $personRepository
|
||||||
|
* @param array|null $centers
|
||||||
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
EntityRepository $personRepository,
|
EntityRepository $personRepository,
|
||||||
array $centers = null
|
array $centers = null
|
||||||
@ -50,11 +63,18 @@ class PersonChoiceLoader implements ChoiceLoaderInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
protected function hasCenterFilter()
|
protected function hasCenterFilter()
|
||||||
{
|
{
|
||||||
return count($this->centers) > 0;
|
return count($this->centers) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param null $value
|
||||||
|
* @return ChoiceListInterface
|
||||||
|
*/
|
||||||
public function loadChoiceList($value = null): ChoiceListInterface
|
public function loadChoiceList($value = null): ChoiceListInterface
|
||||||
{
|
{
|
||||||
$list = new \Symfony\Component\Form\ChoiceList\ArrayChoiceList(
|
$list = new \Symfony\Component\Form\ChoiceList\ArrayChoiceList(
|
||||||
@ -66,6 +86,11 @@ class PersonChoiceLoader implements ChoiceLoaderInterface
|
|||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $values
|
||||||
|
* @param null $value
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function loadChoicesForValues(array $values, $value = null)
|
public function loadChoicesForValues(array $values, $value = null)
|
||||||
{
|
{
|
||||||
$choices = [];
|
$choices = [];
|
||||||
@ -88,6 +113,11 @@ class PersonChoiceLoader implements ChoiceLoaderInterface
|
|||||||
return $choices;
|
return $choices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $choices
|
||||||
|
* @param null $value
|
||||||
|
* @return array|string[]
|
||||||
|
*/
|
||||||
public function loadValuesForChoices(array $choices, $value = null)
|
public function loadValuesForChoices(array $choices, $value = null)
|
||||||
{
|
{
|
||||||
$values = [];
|
$values = [];
|
||||||
|
@ -31,7 +31,7 @@ use Chill\MainBundle\Entity\GroupCenter;
|
|||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
use Chill\MainBundle\Entity\Center;
|
use Chill\MainBundle\Entity\Center;
|
||||||
use Chill\PersonBundle\Entity\PersonRepository;
|
use Chill\PersonBundle\Repository\PersonRepository;
|
||||||
use Chill\PersonBundle\Search\PersonSearch;
|
use Chill\PersonBundle\Search\PersonSearch;
|
||||||
use Symfony\Component\Translation\TranslatorInterface;
|
use Symfony\Component\Translation\TranslatorInterface;
|
||||||
use Chill\PersonBundle\Form\ChoiceLoader\PersonChoiceLoader;
|
use Chill\PersonBundle\Form\ChoiceLoader\PersonChoiceLoader;
|
||||||
@ -55,6 +55,10 @@ use Symfony\Component\OptionsResolver\Options;
|
|||||||
*/
|
*/
|
||||||
class PickPersonType extends AbstractType
|
class PickPersonType extends AbstractType
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var PersonRepository
|
||||||
|
*/
|
||||||
|
protected $personRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -81,6 +85,7 @@ class PickPersonType extends AbstractType
|
|||||||
protected $translator;
|
protected $translator;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
PersonRepository $personRepository,
|
||||||
TokenStorageInterface $tokenStorage,
|
TokenStorageInterface $tokenStorage,
|
||||||
AuthorizationHelper $authorizationHelper,
|
AuthorizationHelper $authorizationHelper,
|
||||||
UrlGeneratorInterface $urlGenerator,
|
UrlGeneratorInterface $urlGenerator,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 Champs-Libres <info@champs-libres.coop>
|
* Copyright (C) 2018 Champs-Libres <info@champs-libres.coop>
|
||||||
*
|
*
|
||||||
@ -15,36 +16,54 @@
|
|||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Chill\PersonBundle\Menu;
|
namespace Chill\PersonBundle\Menu;
|
||||||
|
|
||||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||||
use Knp\Menu\MenuItem;
|
use Knp\Menu\MenuItem;
|
||||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||||
|
use Symfony\Component\Translation\TranslatorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Class SectionMenuBuilder
|
||||||
*
|
*
|
||||||
*
|
* @package Chill\PersonBundle\Menu
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
*/
|
*/
|
||||||
class SectionMenuBuilder implements LocalMenuBuilderInterface
|
class SectionMenuBuilder implements LocalMenuBuilderInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var AuthorizationCheckerInterface
|
* @var AuthorizationCheckerInterface
|
||||||
*/
|
*/
|
||||||
protected $authorizationChecker;
|
protected $authorizationChecker;
|
||||||
|
|
||||||
public function __construct(AuthorizationCheckerInterface $authorizationChecker)
|
/**
|
||||||
|
* @var TranslatorInterface
|
||||||
|
*/
|
||||||
|
protected $translator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SectionMenuBuilder constructor.
|
||||||
|
*
|
||||||
|
* @param AuthorizationCheckerInterface $authorizationChecker
|
||||||
|
* @param TranslatorInterface $translator
|
||||||
|
*/
|
||||||
|
public function __construct(AuthorizationCheckerInterface $authorizationChecker, TranslatorInterface $translator)
|
||||||
{
|
{
|
||||||
$this->authorizationChecker = $authorizationChecker;
|
$this->authorizationChecker = $authorizationChecker;
|
||||||
|
$this->translator = $translator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $menuId
|
||||||
|
* @param MenuItem $menu
|
||||||
|
* @param array $parameters
|
||||||
|
*/
|
||||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
{
|
{
|
||||||
if ($this->authorizationChecker->isGranted(PersonVoter::CREATE)) {
|
if ($this->authorizationChecker->isGranted(PersonVoter::CREATE)) {
|
||||||
$menu->addChild('Add a person', [
|
$menu->addChild($this->translator->trans('Add a person'), [
|
||||||
'route' => 'chill_person_new'
|
'route' => 'chill_person_new'
|
||||||
])
|
])
|
||||||
->setExtras([
|
->setExtras([
|
||||||
@ -54,6 +73,9 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public static function getMenuIds(): array
|
public static function getMenuIds(): array
|
||||||
{
|
{
|
||||||
return [ 'section' ];
|
return [ 'section' ];
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive:
|
|
||||||
table: chill_person_closingmotive
|
|
||||||
type: entity
|
|
||||||
repositoryClass: Chill\PersonBundle\Repository\ClosingMotiveRepository
|
|
||||||
id:
|
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
id: true
|
|
||||||
generator: { strategy: AUTO }
|
|
||||||
fields:
|
|
||||||
name:
|
|
||||||
type: json_array
|
|
||||||
active:
|
|
||||||
type: boolean
|
|
||||||
ordering:
|
|
||||||
type: float
|
|
||||||
options:
|
|
||||||
default: 0.0
|
|
||||||
oneToMany:
|
|
||||||
children:
|
|
||||||
targetEntity: Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive
|
|
||||||
mappedBy: parent
|
|
||||||
manyToOne:
|
|
||||||
parent:
|
|
||||||
targetEntity: Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive
|
|
||||||
inversedBy: children
|
|
@ -1,28 +0,0 @@
|
|||||||
Chill\PersonBundle\Entity\AccompanyingPeriod:
|
|
||||||
table: chill_person_accompanying_period
|
|
||||||
type: entity
|
|
||||||
id:
|
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
id: true
|
|
||||||
generator: { strategy: AUTO }
|
|
||||||
fields:
|
|
||||||
openingDate:
|
|
||||||
type: date
|
|
||||||
closingDate:
|
|
||||||
type: date
|
|
||||||
default: null
|
|
||||||
nullable: true
|
|
||||||
remark:
|
|
||||||
type: text
|
|
||||||
manyToOne:
|
|
||||||
person:
|
|
||||||
targetEntity: Person
|
|
||||||
inversedBy: accompanyingPeriods
|
|
||||||
cascade: [refresh]
|
|
||||||
closingMotive:
|
|
||||||
targetEntity: Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive
|
|
||||||
nullable: true
|
|
||||||
user:
|
|
||||||
targetEntity: Chill\MainBundle\Entity\User
|
|
||||||
nullable: true
|
|
@ -1,11 +0,0 @@
|
|||||||
Chill\PersonBundle\Entity\MaritalStatus:
|
|
||||||
table: chill_person_marital_status
|
|
||||||
type: entity
|
|
||||||
id:
|
|
||||||
id:
|
|
||||||
type: string
|
|
||||||
length: 7
|
|
||||||
fields:
|
|
||||||
name:
|
|
||||||
type: json_array
|
|
||||||
lifecycleCallbacks: { }
|
|
@ -1,99 +0,0 @@
|
|||||||
Chill\PersonBundle\Entity\Person:
|
|
||||||
type: entity
|
|
||||||
table: chill_person_person
|
|
||||||
indexes:
|
|
||||||
person_names:
|
|
||||||
columns: [firstName, lastName]
|
|
||||||
repositoryClass: Chill\PersonBundle\Repository\PersonRepository
|
|
||||||
fields:
|
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
id: true
|
|
||||||
generator:
|
|
||||||
strategy: AUTO
|
|
||||||
firstName:
|
|
||||||
type: string
|
|
||||||
length: 255
|
|
||||||
lastName:
|
|
||||||
type: string
|
|
||||||
length: 255
|
|
||||||
birthdate:
|
|
||||||
type: date
|
|
||||||
nullable: true
|
|
||||||
placeOfBirth:
|
|
||||||
type: string
|
|
||||||
length: 255
|
|
||||||
column: place_of_birth
|
|
||||||
default: ''
|
|
||||||
gender:
|
|
||||||
type: string
|
|
||||||
length: 9
|
|
||||||
nullable: true
|
|
||||||
memo:
|
|
||||||
type: text
|
|
||||||
default: ''
|
|
||||||
contactInfo:
|
|
||||||
type: text
|
|
||||||
nullable: true
|
|
||||||
email:
|
|
||||||
type: text
|
|
||||||
nullable: true
|
|
||||||
proxyAccompanyingPeriodOpenState:
|
|
||||||
type: boolean
|
|
||||||
name: proxy_open
|
|
||||||
cFData:
|
|
||||||
type: json_array
|
|
||||||
phonenumber:
|
|
||||||
type: text
|
|
||||||
nullable: true
|
|
||||||
length: 40
|
|
||||||
mobilenumber:
|
|
||||||
type: text
|
|
||||||
nullable: true
|
|
||||||
length: 40
|
|
||||||
fullnameCanonical:
|
|
||||||
type: text
|
|
||||||
nullable: true
|
|
||||||
manyToOne:
|
|
||||||
countryOfBirth:
|
|
||||||
targetEntity: Chill\MainBundle\Entity\Country
|
|
||||||
inversedBy: birthsIn
|
|
||||||
nullable: true
|
|
||||||
nationality:
|
|
||||||
targetEntity: Chill\MainBundle\Entity\Country
|
|
||||||
inversedBy: nationals
|
|
||||||
nullable: true
|
|
||||||
center:
|
|
||||||
targetEntity: Chill\MainBundle\Entity\Center
|
|
||||||
nullable: false
|
|
||||||
maritalStatus:
|
|
||||||
targetEntity: Chill\PersonBundle\Entity\MaritalStatus
|
|
||||||
nullable: true
|
|
||||||
oneToMany:
|
|
||||||
accompanyingPeriods:
|
|
||||||
targetEntity: AccompanyingPeriod
|
|
||||||
mappedBy: person
|
|
||||||
cascade: [persist, remove, merge, detach]
|
|
||||||
altNames:
|
|
||||||
targetEntity: PersonAltName
|
|
||||||
mappedBy: person
|
|
||||||
cascade: [persist, remove, merge, detach]
|
|
||||||
orphanRemoval: true
|
|
||||||
manyToMany:
|
|
||||||
spokenLanguages:
|
|
||||||
targetEntity: Chill\MainBundle\Entity\Language
|
|
||||||
joinTable:
|
|
||||||
name: persons_spoken_languages
|
|
||||||
joinColumns:
|
|
||||||
person_id:
|
|
||||||
referencedColumnName: id
|
|
||||||
inverseJoinColumns:
|
|
||||||
language_id:
|
|
||||||
referencedColumnName: id
|
|
||||||
addresses:
|
|
||||||
targetEntity: Chill\MainBundle\Entity\Address
|
|
||||||
orderBy: { 'validFrom': 'DESC' }
|
|
||||||
joinTable:
|
|
||||||
name: chill_person_persons_to_addresses
|
|
||||||
cascade: [persist, remove, merge, detach]
|
|
||||||
lifecycleCallbacks: { }
|
|
@ -1,21 +0,0 @@
|
|||||||
Chill\PersonBundle\Entity\PersonAltName:
|
|
||||||
type: entity
|
|
||||||
table: chill_person_alt_name
|
|
||||||
repositoryClass: Chill\PersonBundle\Repository\PersonAltNameRepository
|
|
||||||
id:
|
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
id: true
|
|
||||||
generator:
|
|
||||||
strategy: AUTO
|
|
||||||
fields:
|
|
||||||
key:
|
|
||||||
type: string
|
|
||||||
length: 255
|
|
||||||
label:
|
|
||||||
type: text
|
|
||||||
|
|
||||||
manyToOne:
|
|
||||||
person:
|
|
||||||
targetEntity: Person
|
|
||||||
inversedBy: altNames
|
|
@ -11,10 +11,12 @@ services:
|
|||||||
- "@doctrine.orm.entity_manager"
|
- "@doctrine.orm.entity_manager"
|
||||||
tags:
|
tags:
|
||||||
- { name: form.type, alias: select2_chill_marital_status }
|
- { name: form.type, alias: select2_chill_marital_status }
|
||||||
|
|
||||||
chill.person.timeline.accompanying_period_opening:
|
chill.person.timeline.accompanying_period_opening:
|
||||||
class: Chill\PersonBundle\Timeline\TimelineAccompanyingPeriodOpening
|
class: Chill\PersonBundle\Timeline\TimelineAccompanyingPeriodOpening
|
||||||
arguments:
|
arguments:
|
||||||
- "@doctrine.orm.entity_manager"
|
- "@doctrine.orm.entity_manager"
|
||||||
|
public: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.timeline, context: 'person' }
|
- { name: chill.timeline, context: 'person' }
|
||||||
|
|
||||||
@ -22,6 +24,7 @@ services:
|
|||||||
class: Chill\PersonBundle\Timeline\TimelineAccompanyingPeriodClosing
|
class: Chill\PersonBundle\Timeline\TimelineAccompanyingPeriodClosing
|
||||||
arguments:
|
arguments:
|
||||||
- "@doctrine.orm.entity_manager"
|
- "@doctrine.orm.entity_manager"
|
||||||
|
public: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.timeline, context: 'person' }
|
- { name: chill.timeline, context: 'person' }
|
||||||
|
|
||||||
|
@ -11,9 +11,13 @@ services:
|
|||||||
Chill\PersonBundle\Controller\TimelinePersonController:
|
Chill\PersonBundle\Controller\TimelinePersonController:
|
||||||
arguments:
|
arguments:
|
||||||
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
||||||
|
$timelineBuilder: '@chill_main.timeline_builder'
|
||||||
|
$paginatorFactory: '@chill_main.paginator_factory'
|
||||||
|
tags: ['controller.service_arguments']
|
||||||
|
|
||||||
Chill\PersonBundle\Controller\AccompanyingPeriodController:
|
Chill\PersonBundle\Controller\AccompanyingPeriodController:
|
||||||
arguments:
|
arguments:
|
||||||
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
||||||
|
tags: ['controller.service_arguments']
|
||||||
|
|
||||||
Chill\PersonBundle\Controller\AdminController: ~
|
Chill\PersonBundle\Controller\AdminController: ~
|
||||||
|
@ -32,6 +32,7 @@ services:
|
|||||||
chill.person.form.type.pick_person:
|
chill.person.form.type.pick_person:
|
||||||
class: Chill\PersonBundle\Form\Type\PickPersonType
|
class: Chill\PersonBundle\Form\Type\PickPersonType
|
||||||
arguments:
|
arguments:
|
||||||
|
- "@chill.person.repository.person"
|
||||||
- "@security.token_storage"
|
- "@security.token_storage"
|
||||||
- "@chill.main.security.authorization.helper"
|
- "@chill.main.security.authorization.helper"
|
||||||
- '@Symfony\Component\Routing\Generator\UrlGeneratorInterface'
|
- '@Symfony\Component\Routing\Generator\UrlGeneratorInterface'
|
||||||
|
@ -2,6 +2,7 @@ services:
|
|||||||
Chill\PersonBundle\Menu\SectionMenuBuilder:
|
Chill\PersonBundle\Menu\SectionMenuBuilder:
|
||||||
arguments:
|
arguments:
|
||||||
$authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
|
$authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
|
||||||
|
$translator: '@Symfony\Component\Translation\TranslatorInterface'
|
||||||
tags:
|
tags:
|
||||||
- { name: 'chill.menu_builder' }
|
- { name: 'chill.menu_builder' }
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
services:
|
services:
|
||||||
|
|
||||||
Chill\PersonBundle\Repository\PersonRepository:
|
chill.person.repository.person:
|
||||||
class: Chill\PersonBundle\Person\PersonRepository
|
class: Chill\PersonBundle\Repository\PersonRepository
|
||||||
factory: ['@doctrine.orm.entity_manager', getRepository]
|
factory: ['@doctrine.orm.entity_manager', getRepository]
|
||||||
arguments:
|
arguments:
|
||||||
- 'Chill\PersonBundle\Entity\Person'
|
- 'Chill\PersonBundle\Entity\Person'
|
||||||
|
Chill\PersonBundle\Repository\PersonRepository: '@chill.person.repository.person'
|
||||||
|
|
||||||
Chill\PersonBundle\Repository\ClosingMotiveRepository:
|
Chill\PersonBundle\Repository\ClosingMotiveRepository:
|
||||||
class: Chill\PersonBundle\Repository\ClosingMotiveRepository
|
class: Chill\PersonBundle\Repository\ClosingMotiveRepository
|
||||||
|
@ -2,6 +2,7 @@ services:
|
|||||||
chill_person.widget.person_list:
|
chill_person.widget.person_list:
|
||||||
class: Chill\PersonBundle\Widget\PersonListWidget
|
class: Chill\PersonBundle\Widget\PersonListWidget
|
||||||
arguments:
|
arguments:
|
||||||
|
- "@chill.person.repository.person"
|
||||||
- "@doctrine.orm.entity_manager"
|
- "@doctrine.orm.entity_manager"
|
||||||
- "@chill.main.security.authorization.helper"
|
- "@chill.main.security.authorization.helper"
|
||||||
- "@security.token_storage"
|
- "@security.token_storage"
|
||||||
|
@ -152,6 +152,7 @@ Back to the person details: Retour aux détails de la personne
|
|||||||
Timeline: Historique
|
Timeline: Historique
|
||||||
Closing the accompanying period: Fermeture de la période d'accompagnement
|
Closing the accompanying period: Fermeture de la période d'accompagnement
|
||||||
Opening the accompanying period: Ouverture d'une période d'accompagnement
|
Opening the accompanying period: Ouverture d'une période d'accompagnement
|
||||||
|
'Timeline for %name%': 'Historique de %name%'
|
||||||
|
|
||||||
#roles
|
#roles
|
||||||
CHILL_PERSON_SEE: Voir les personnes
|
CHILL_PERSON_SEE: Voir les personnes
|
||||||
|
@ -41,6 +41,12 @@ use Chill\CustomFieldsBundle\Entity\CustomField;
|
|||||||
*/
|
*/
|
||||||
class PersonListWidget implements WidgetInterface
|
class PersonListWidget implements WidgetInterface
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Repository for persons
|
||||||
|
*
|
||||||
|
* @var EntityRepository
|
||||||
|
*/
|
||||||
|
protected $personRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The entity manager
|
* The entity manager
|
||||||
@ -69,6 +75,7 @@ class PersonListWidget implements WidgetInterface
|
|||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
EntityRepository $personRepostory,
|
||||||
EntityManager $em,
|
EntityManager $em,
|
||||||
AuthorizationHelper $authorizationHelper,
|
AuthorizationHelper $authorizationHelper,
|
||||||
TokenStorage $tokenStorage
|
TokenStorage $tokenStorage
|
||||||
|
Loading…
x
Reference in New Issue
Block a user