mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-04 07:56:12 +00:00
Adding spokenLanguages to Person (Entity and Form)
This commit is contained in:
parent
8a65274fbc
commit
ae36da3366
@ -23,6 +23,7 @@ namespace Chill\PersonBundle\Entity;
|
|||||||
|
|
||||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||||
use Chill\MainBundle\Entity\Country;
|
use Chill\MainBundle\Entity\Country;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Person
|
* Person
|
||||||
@ -105,15 +106,21 @@ class Person {
|
|||||||
*/
|
*/
|
||||||
private $phonenumber = '';
|
private $phonenumber = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The spoken languages (ArrayCollection of Languages)
|
||||||
|
* @var \Doctrine\Common\Collections\ArrayCollection
|
||||||
|
*/
|
||||||
|
private $spokenLanguages;
|
||||||
|
|
||||||
public function __construct(\DateTime $opening = null) {
|
public function __construct(\DateTime $opening = null) {
|
||||||
$this->history = new \Doctrine\Common\Collections\ArrayCollection();
|
$this->history = new ArrayCollection();
|
||||||
|
$this->spokenLanguages = new ArrayCollection();
|
||||||
|
|
||||||
if ($opening === null) {
|
if ($opening === null) {
|
||||||
$opening = new \DateTime();
|
$opening = new \DateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->open(new PersonHistoryFile($opening));
|
$this->open(new PersonHistoryFile($opening));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -531,6 +538,28 @@ class Person {
|
|||||||
return $this->getLabel();
|
return $this->getLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set spokenLanguages
|
||||||
|
*
|
||||||
|
* @param type $spokenLanguages
|
||||||
|
* @return Person
|
||||||
|
*/
|
||||||
|
public function setSpokenLanguages($spokenLanguages)
|
||||||
|
{
|
||||||
|
$this->spokenLanguages = $spokenLanguages;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get spokenLanguages
|
||||||
|
*
|
||||||
|
* @return ArrayCollection
|
||||||
|
*/
|
||||||
|
public function getSpokenLanguages()
|
||||||
|
{
|
||||||
|
return $this->spokenLanguages;
|
||||||
|
}
|
||||||
|
|
||||||
// VALIDATION
|
// VALIDATION
|
||||||
public function isHistoryValid(ExecutionContextInterface $context) {
|
public function isHistoryValid(ExecutionContextInterface $context) {
|
||||||
|
@ -53,6 +53,10 @@ class PersonType extends AbstractType
|
|||||||
->add('nationality', 'select2_chill_country', array(
|
->add('nationality', 'select2_chill_country', array(
|
||||||
'required' => false
|
'required' => false
|
||||||
))
|
))
|
||||||
|
->add('spokenLanguages', 'select2_chill_language', array(
|
||||||
|
'required' => false,
|
||||||
|
'multiple' => true
|
||||||
|
))
|
||||||
;
|
;
|
||||||
|
|
||||||
if($options['cFGroup']) {
|
if($options['cFGroup']) {
|
||||||
|
@ -53,4 +53,9 @@ Chill\PersonBundle\Entity\Person:
|
|||||||
targetEntity: PersonHistoryFile
|
targetEntity: PersonHistoryFile
|
||||||
mappedBy: person
|
mappedBy: person
|
||||||
cascade: [persist, remove, merge, detach]
|
cascade: [persist, remove, merge, detach]
|
||||||
|
manyToMany:
|
||||||
|
spokenLanguages:
|
||||||
|
targetEntity: Chill\MainBundle\Entity\Language
|
||||||
|
joinTable:
|
||||||
|
name: persons_spoken_languages
|
||||||
lifecycleCallbacks: { }
|
lifecycleCallbacks: { }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user