mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Renaming genre into gender & dateOfBirth into birthdate
This commit is contained in:
parent
02193505be
commit
31e734f2c7
@ -194,8 +194,8 @@ class PersonController extends Controller
|
||||
|
||||
$person->setFirstName($form['firstName']->getData())
|
||||
->setLastName($form['lastName']->getData())
|
||||
->setGenre($form['genre']->getData())
|
||||
->setDateOfBirth($form['dateOfBirth']->getData())
|
||||
->setGender($form['gender']->getData())
|
||||
->setBirthdate($form['birthdate']->getData())
|
||||
->setCenter($form['center']->getData())
|
||||
;
|
||||
|
||||
@ -301,8 +301,8 @@ class PersonController extends Controller
|
||||
array('alternatePersons' => $alternatePersons,
|
||||
'firstName' => $form['firstName']->getData(),
|
||||
'lastName' => $form['lastName']->getData(),
|
||||
'dateOfBirth' => $form['dateOfBirth']->getData(),
|
||||
'genre' => $form['genre']->getData(),
|
||||
'birthdate' => $form['birthdate']->getData(),
|
||||
'gender' => $form['gender']->getData(),
|
||||
'creation_date' => $form['creation_date']->getData(),
|
||||
'form' => $form->createView()));
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
|
||||
do {
|
||||
$i++;
|
||||
|
||||
$sex = $this->genres[array_rand($this->genres)];
|
||||
$sex = $this->genders[array_rand($this->genders)];
|
||||
|
||||
if ($chooseLastNameOrTri[array_rand($chooseLastNameOrTri)] === 'tri' ) {
|
||||
$length = rand(2, 3);
|
||||
@ -108,7 +108,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
|
||||
$lastName = $this->lastNames[array_rand($this->lastNames)];
|
||||
}
|
||||
|
||||
if ($sex === Person::GENRE_MAN) {
|
||||
if ($sex === Person::MALE_GENDER) {
|
||||
$firstName = $this->firstNamesMale[array_rand($this->firstNamesMale)];
|
||||
} else {
|
||||
$firstName = $this->firstNamesFemale[array_rand($this->firstNamesFemale)];
|
||||
@ -117,7 +117,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
|
||||
$person = array(
|
||||
'FirstName' => $firstName,
|
||||
'LastName' => $lastName,
|
||||
'Genre' => $sex,
|
||||
'Gender' => $sex,
|
||||
'Nationality' => (rand(0,100) > 50) ? NULL: 'BE',
|
||||
'center' => (rand(0,1) == 0) ? 'centerA': 'centerB'
|
||||
);
|
||||
@ -135,9 +135,9 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
|
||||
private function fillWithDefault(array $specific)
|
||||
{
|
||||
return array_merge(array(
|
||||
'DateOfBirth' => "1960-10-12",
|
||||
'Birthdate' => "1960-10-12",
|
||||
'PlaceOfBirth' => "Ottignies Louvain-La-Neuve",
|
||||
'Genre' => Person::GENRE_MAN,
|
||||
'Gender' => Person::MALE_GENDER,
|
||||
'Email' => "Email d'un ami: roger@tt.com",
|
||||
'CountryOfBirth' => 'BE',
|
||||
'Nationality' => 'BE',
|
||||
@ -157,7 +157,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
|
||||
case 'Nationality':
|
||||
$value = $this->getCountry($value);
|
||||
break;
|
||||
case 'DateOfBirth':
|
||||
case 'Birthdate':
|
||||
$value = new \DateTime($value);
|
||||
break;
|
||||
case 'center':
|
||||
@ -196,7 +196,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
|
||||
'ma', 'gone', 'car',"fu", "ka", "lot", "no", "va", "du", "bu", "su",
|
||||
"lo", 'to', "cho", "car", 'mo','zu', 'qi', 'mu');
|
||||
|
||||
private $genres = array(Person::GENRE_MAN, Person::GENRE_WOMAN);
|
||||
private $genders = array(Person::MALE_GENDER, Person::FEMALE_GENDER);
|
||||
|
||||
private $years = array();
|
||||
|
||||
@ -208,9 +208,9 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
|
||||
array(
|
||||
'FirstName' => "Depardieu",
|
||||
'LastName' => "Gérard",
|
||||
'DateOfBirth' => "1948-12-27",
|
||||
'Birthdate' => "1948-12-27",
|
||||
'PlaceOfBirth' => "Châteauroux",
|
||||
'Genre' => Person::GENRE_MAN,
|
||||
'Gender' => Person::MALE_GENDER,
|
||||
'CountryOfBirth' => 'FR',
|
||||
'Nationality' => 'RU',
|
||||
'center' => 'centerA'
|
||||
@ -219,7 +219,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
|
||||
//to have a person with same firstname as Gérard Depardieu
|
||||
'FirstName' => "Depardieu",
|
||||
'LastName' => "Jean",
|
||||
'DateOfBirth' => "1960-10-12",
|
||||
'Birthdate' => "1960-10-12",
|
||||
'CountryOfBirth' => 'FR',
|
||||
'Nationality' => 'FR',
|
||||
'center' => 'centerA'
|
||||
@ -228,14 +228,14 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
|
||||
//to have a person with same birthdate of Gérard Depardieu
|
||||
'FirstName' => 'Van Snick',
|
||||
'LastName' => 'Bart',
|
||||
'DateOfBirth' => '1948-12-27',
|
||||
'Birthdate' => '1948-12-27',
|
||||
'center' => 'centerA'
|
||||
),
|
||||
array(
|
||||
//to have a woman with Depardieu as FirstName
|
||||
'FirstName' => 'Depardieu',
|
||||
'LastName' => 'Charline',
|
||||
'Genre' => Person::GENRE_WOMAN,
|
||||
'Gender' => Person::FEMALE_GENDER,
|
||||
'center' => 'centerA'
|
||||
),
|
||||
array(
|
||||
|
@ -41,7 +41,7 @@ class Person implements HasCenterInterface {
|
||||
private $lastName;
|
||||
|
||||
/** @var \DateTime The person's birthdate */
|
||||
private $dateOfBirth; //to change in birthdate
|
||||
private $birthdate; //to change in birthdate
|
||||
|
||||
/** @var string The person's place of birth */
|
||||
private $placeOfBirth = '';
|
||||
@ -53,43 +53,51 @@ class Person implements HasCenterInterface {
|
||||
private $nationality;
|
||||
|
||||
/** @var string The person's gender */
|
||||
private $genre; //to change in gender
|
||||
private $gender;
|
||||
|
||||
const GENRE_MAN = 'man';
|
||||
const GENRE_WOMAN = 'woman';
|
||||
|
||||
/** @var \Chill\MainBundle\Entity\Center The person's center */
|
||||
private $center;
|
||||
const MALE_GENDER = 'man';
|
||||
const FEMALE_GENDER = 'woman';
|
||||
|
||||
/** @var string A remark over the person */
|
||||
private $memo = ''; // to change in remark
|
||||
//TO-ADD : maritalStatus
|
||||
|
||||
//TO-ADD : address
|
||||
|
||||
/** @var string The person's email */
|
||||
private $email = '';
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\ArrayCollection The person's
|
||||
* accompanying periods (when the person was accompanied by the center)*/
|
||||
private $accompanyingPeriods;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
private $proxyAccompanyingPeriodOpenState = false;
|
||||
|
||||
|
||||
/** @var array Array where customfield's data are stored */
|
||||
private $cFData;
|
||||
|
||||
/** @var string The person's phonenumber */
|
||||
private $phonenumber = '';
|
||||
|
||||
//TO-ADD : caseOpeningDate
|
||||
|
||||
//TO-ADD nativeLanguag
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\ArrayCollection The person's spoken
|
||||
* languages (ArrayCollection of Languages)
|
||||
*/
|
||||
private $spokenLanguages;
|
||||
|
||||
/** @var \Chill\MainBundle\Entity\Center The person's center */
|
||||
private $center;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\ArrayCollection The person's
|
||||
* accompanying periods (when the person was accompanied by the center)*/
|
||||
private $accompanyingPeriods; //TO-CHANGE in accompanyingHistory
|
||||
|
||||
/** @var string A remark over the person */
|
||||
private $memo = ''; // TO-CHANGE in remark
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
private $proxyAccompanyingPeriodOpenState = false; //TO-DELETE ?
|
||||
|
||||
|
||||
/** @var array Array where customfield's data are stored */
|
||||
private $cFData;
|
||||
|
||||
public function __construct(\DateTime $opening = null) {
|
||||
$this->accompanyingPeriods = new ArrayCollection();
|
||||
$this->spokenLanguages = new ArrayCollection();
|
||||
@ -272,26 +280,26 @@ class Person implements HasCenterInterface {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set dateOfBirth
|
||||
* Set birthdate
|
||||
*
|
||||
* @param \DateTime $dateOfBirth
|
||||
* @param \DateTime $birthdate
|
||||
* @return Person
|
||||
*/
|
||||
public function setDateOfBirth($dateOfBirth)
|
||||
public function setBirthdate($birthdate)
|
||||
{
|
||||
$this->dateOfBirth = $dateOfBirth;
|
||||
$this->birthdate = $birthdate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get dateOfBirth
|
||||
* Get birthdate
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getDateOfBirth()
|
||||
public function getBirthdate()
|
||||
{
|
||||
return $this->dateOfBirth;
|
||||
return $this->birthdate;
|
||||
}
|
||||
|
||||
|
||||
@ -323,26 +331,26 @@ class Person implements HasCenterInterface {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set genre
|
||||
* Set gender
|
||||
*
|
||||
* @param string $genre
|
||||
* @param string $gender
|
||||
* @return Person
|
||||
*/
|
||||
public function setGenre($genre)
|
||||
public function setGender($gender)
|
||||
{
|
||||
$this->genre = $genre;
|
||||
$this->gender = $gender;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get genre
|
||||
* Get gender
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getGenre()
|
||||
public function getGender()
|
||||
{
|
||||
return $this->genre;
|
||||
return $this->gender;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -350,8 +358,8 @@ class Person implements HasCenterInterface {
|
||||
* This is used for translations
|
||||
* @return int
|
||||
*/
|
||||
public function getGenreNumeric() {
|
||||
if ($this->getGenre() == self::GENRE_WOMAN) {
|
||||
public function getGenderNumeric() {
|
||||
if ($this->getGender() == self::FEMALE_GENDER) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
|
@ -58,10 +58,10 @@ class CreationPersonType extends AbstractType
|
||||
|
||||
$builder->add('firstName', 'hidden')
|
||||
->add('lastName', 'hidden')
|
||||
->add( $builder->create('dateOfBirth', 'hidden')
|
||||
->add( $builder->create('birthdate', 'hidden')
|
||||
->addModelTransformer($dateToStringTransformer)
|
||||
)
|
||||
->add('genre', 'hidden')
|
||||
->add('gender', 'hidden')
|
||||
->add( $builder->create('creation_date', 'hidden')
|
||||
->addModelTransformer($dateToStringTransformer)
|
||||
)
|
||||
@ -72,9 +72,9 @@ class CreationPersonType extends AbstractType
|
||||
$builder
|
||||
->add('firstName')
|
||||
->add('lastName')
|
||||
->add('dateOfBirth', 'date', array('required' => false,
|
||||
->add('birthdate', 'date', array('required' => false,
|
||||
'widget' => 'single_text', 'format' => 'dd-MM-yyyy'))
|
||||
->add('genre', new GenderType(), array(
|
||||
->add('gender', new GenderType(), array(
|
||||
'required' => true, 'empty_value' => null
|
||||
))
|
||||
->add('creation_date', 'date', array('required' => true,
|
||||
|
@ -39,9 +39,9 @@ class PersonType extends AbstractType
|
||||
$builder
|
||||
->add('firstName')
|
||||
->add('lastName')
|
||||
->add('dateOfBirth', 'date', array('required' => false, 'widget' => 'single_text', 'format' => 'dd-MM-yyyy'))
|
||||
->add('birthdate', 'date', array('required' => false, 'widget' => 'single_text', 'format' => 'dd-MM-yyyy'))
|
||||
->add('placeOfBirth', 'text', array('required' => false))
|
||||
->add('genre', new GenderType(), array(
|
||||
->add('gender', new GenderType(), array(
|
||||
'required' => true
|
||||
))
|
||||
->add('memo', 'textarea', array('required' => false))
|
||||
|
@ -25,8 +25,8 @@ class GenderType extends AbstractType {
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver) {
|
||||
|
||||
$a = array(
|
||||
Person::GENRE_MAN => Person::GENRE_MAN,
|
||||
Person::GENRE_WOMAN => Person::GENRE_WOMAN
|
||||
Person::MALE_GENDER => Person::MALE_GENDER,
|
||||
Person::FEMALE_GENDER => Person::FEMALE_GENDER
|
||||
);
|
||||
|
||||
$resolver->setDefaults(array(
|
||||
|
@ -17,16 +17,15 @@ Chill\PersonBundle\Entity\Person:
|
||||
lastName:
|
||||
type: string
|
||||
length: 255
|
||||
dateOfBirth:
|
||||
birthdate:
|
||||
type: date
|
||||
column: date_of_birth
|
||||
nullable: true
|
||||
placeOfBirth:
|
||||
type: string
|
||||
length: 255
|
||||
column: place_of_birth
|
||||
default: ''
|
||||
genre:
|
||||
gender:
|
||||
type: string
|
||||
length: 9
|
||||
memo:
|
||||
|
@ -18,11 +18,11 @@ Chill\PersonBundle\Entity\Person:
|
||||
minMessage: 'This name is too short. It must containt {{ limit }} chars'
|
||||
maxMessage: 'This name is too long. It must containt {{ limit }} chars'
|
||||
groups: [general, creation]
|
||||
dateOfBirth:
|
||||
birthdate:
|
||||
- Date:
|
||||
message: 'Birthdate not valid'
|
||||
groups: [general, creation]
|
||||
genre:
|
||||
gender:
|
||||
- NotNull:
|
||||
groups: [general, creation]
|
||||
accompanyingPeriods:
|
||||
|
66
Resources/migrations/Version20150811152608.php
Normal file
66
Resources/migrations/Version20150811152608.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* Copyright (C) 2014-2015, 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 Application\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
||||
/**
|
||||
* Migration for adapting the Person Bundle to the 'cahier de charge' :
|
||||
* - RENAMING :
|
||||
* - - date_of_birth TO birthdate
|
||||
* - - genre to gender
|
||||
*
|
||||
*/
|
||||
class Version20150811152608 extends AbstractMigration
|
||||
{
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function up(Schema $schema)
|
||||
{
|
||||
$this->abortIf(
|
||||
$this->connection->getDatabasePlatform()->getName() != 'postgresql',
|
||||
'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('ALTER TABLE person RENAME COLUMN date_of_birth TO birthdate');
|
||||
$this->addSql('ALTER TABLE person RENAME COLUMN genre TO gender');
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema)
|
||||
{
|
||||
$this->abortIf(
|
||||
$this->connection->getDatabasePlatform()->getName() != 'postgresql',
|
||||
'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('ALTER TABLE person RENAME COLUMN birthdate TO date_of_birth');
|
||||
$this->addSql('ALTER TABLE person RENAME COLUMN gender TO genre');
|
||||
|
||||
}
|
||||
}
|
@ -29,9 +29,9 @@
|
||||
|
||||
{{ form_row(form.lastName, { 'label' : 'Last name'|trans }) }}
|
||||
|
||||
{{ form_row(form.dateOfBirth, { 'label' : 'Date of birth'|trans }) }}
|
||||
{{ form_row(form.birthdate, { 'label' : 'Date of birth'|trans }) }}
|
||||
|
||||
{{ form_row(form.genre, { 'label' : 'Gender'|trans }) }}
|
||||
{{ form_row(form.gender, { 'label' : 'Gender'|trans }) }}
|
||||
|
||||
{{ form_row(form.creation_date, { 'label' : 'Creation date'|trans }) }}
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
{% endspaceless %}
|
||||
</a>
|
||||
</td>
|
||||
<td>{{ person.dateOfBirth|localizeddate('long', 'none', app.request.locale) }}</td>
|
||||
<td>{{ person.birthdate|localizeddate('long', 'none', app.request.locale) }}</td>
|
||||
<td>{% if person.nationality is not null %}{{ person.nationality.name|localize_translatable_string }}{% else %}{{ 'Without nationality'|trans }}{% endif %}
|
||||
</tr>
|
||||
|
||||
@ -61,10 +61,10 @@
|
||||
<dd>{{ lastName }}</dd>
|
||||
|
||||
<dt>{{ 'Date of birth'|trans }}</dt>
|
||||
<dd>{{ dateOfBirth|localizeddate('long', 'none', app.request.locale)|default( 'Unknown date of birth'|trans ) }}</dd>
|
||||
<dd>{{ birthdate|localizeddate('long', 'none', app.request.locale)|default( 'Unknown date of birth'|trans ) }}</dd>
|
||||
|
||||
<dt>{{ 'Gender'|trans }}</dt>
|
||||
<dd>{{ genre|trans }}</dd>
|
||||
<dd>{{ gender|trans }}</dd>
|
||||
|
||||
<dt>{{ 'Creation date'|trans }}</dt>
|
||||
<dd>{{ creation_date|localizeddate('long', 'none', app.request.locale) }}</dd>
|
||||
|
@ -30,12 +30,12 @@
|
||||
<legend><h2>{{ 'General information'|trans }}</h2></legend>
|
||||
{{ form_row(form.firstName, {'label' : 'First name'}) }}
|
||||
{{ form_row(form.lastName, {'label' : 'Last name'}) }}
|
||||
{{ form_row(form.genre, {'label' : 'Gender'}) }}
|
||||
{{ form_row(form.gender, {'label' : 'Gender'}) }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend><h2>{{ 'Birth information'|trans }}</h2></legend>
|
||||
{{ form_row(form.dateOfBirth, {'label': 'Date of birth'} ) }}
|
||||
{{ form_row(form.birthdate, {'label': 'Date of birth'} ) }}
|
||||
{{ form_row(form.placeOfBirth, { 'label' : 'Place of birth'} ) }}
|
||||
{{ form_row(form.countryOfBirth, { 'label' : 'Country of birth' } ) }}
|
||||
</fieldset>
|
||||
|
@ -19,8 +19,8 @@
|
||||
#}{{ person.id }},{#
|
||||
#}"{{ person.firstName|csv_cell }}",{#
|
||||
#}"{{ person.lastName|csv_cell }}",{#
|
||||
#}"{{ person.genre|csv_cell }}",{#
|
||||
#}"{{ person.dateOfBirth|localizeddate('short', 'none') }}",{#
|
||||
#}"{{ person.gender|csv_cell }}",{#
|
||||
#}"{{ person.birthdate|localizeddate('short', 'none') }}",{#
|
||||
#}"{# countryOfBirth
|
||||
#}{% if person.countryOfBirth is not null %}{#
|
||||
#}{{ person.countryOfBirth.name|localize_translatable_string }}{#
|
||||
|
@ -42,11 +42,11 @@
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<span class="personDateOfBirth">{% if person.dateOfBirth is not null %}{{person.dateOfBirth|localizeddate('long', 'none', app.request.locale) }}{% else %}{{ 'Unknown date of birth'|trans }}{% endif %}</span>
|
||||
{% if person.birthdate is not null %}{{person.birthdate|localizeddate('long', 'none', app.request.locale) }}{% else %}{{ 'Unknown date of birth'|trans }}{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if person.nationality is not null %}
|
||||
<span class="personNationality">{{person.nationality.name | localize_translatable_string }}</span>
|
||||
{{person.nationality.name | localize_translatable_string }}
|
||||
{% else %}
|
||||
{{ 'Without nationality'|trans }}
|
||||
{% endif %}
|
||||
|
@ -50,7 +50,7 @@ This view should receive those arguments:
|
||||
<dd>{{ person.lastName }}</dd>
|
||||
|
||||
<dt class="inline">{{ 'Gender'|trans }}</dt>
|
||||
<dd>{{ ( person.genre|default('Not given'))|trans }}</dd>
|
||||
<dd>{{ ( person.gender|default('Not given'))|trans }}</dd>
|
||||
</dl>
|
||||
</figure>
|
||||
|
||||
@ -60,8 +60,8 @@ This view should receive those arguments:
|
||||
<dl>
|
||||
<dt class="inline">{{ 'Date of birth'|trans }}</dt>
|
||||
<dd>
|
||||
{%- if person.dateOfBirth is not null -%}
|
||||
{{ person.dateOfBirth|localizeddate('long', 'none') }}
|
||||
{%- if person.birthdate is not null -%}
|
||||
{{ person.birthdate|localizeddate('long', 'none') }}
|
||||
{%- else -%}
|
||||
{{ 'Unknown date of birth'|trans }}
|
||||
{%- endif -%}
|
||||
|
@ -36,11 +36,11 @@
|
||||
<div class="grid-10 push-1 parent">
|
||||
<div class="grid-4">
|
||||
{{ 'Birthdate :'|trans|upper }}
|
||||
{% if person.dateOfBirth == null %}
|
||||
{% if person.birthdate == null %}
|
||||
{{ 'Unknown date of birth'|trans }}, {{ ('person.gender.' ~
|
||||
person.genre)|trans }}
|
||||
person.gender)|trans }}
|
||||
{% else %}
|
||||
{{ person.dateOfBirth|localizeddate('long', 'none') }}
|
||||
{{ person.birthdate|localizeddate('long', 'none') }}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="grid-4">
|
||||
@ -53,7 +53,7 @@
|
||||
</div>
|
||||
<div class="grid-4">
|
||||
{{ 'Gender:'|trans|upper}}
|
||||
{{ person.genre }}
|
||||
{{ person.gender }}
|
||||
</div>
|
||||
<!--
|
||||
<div class="grid-4">
|
||||
|
@ -172,18 +172,18 @@ class PersonSearch extends AbstractSearch implements ContainerAwareInterface
|
||||
. 'not parsable', 0, $ex);
|
||||
}
|
||||
|
||||
$qb->andWhere($qb->expr()->eq('p.dateOfBirth', ':birthdate'))
|
||||
$qb->andWhere($qb->expr()->eq('p.birthdate', ':birthdate'))
|
||||
->setParameter('birthdate', $date);
|
||||
}
|
||||
|
||||
if (array_key_exists('gender', $terms)) {
|
||||
if (!in_array($terms['gender'], array(Person::GENRE_MAN, Person::GENRE_WOMAN))) {
|
||||
if (!in_array($terms['gender'], array(Person::MALE_GENDER, Person::FEMALE_GENDER))) {
|
||||
throw new ParsingException('The gender '
|
||||
.$terms['gender'].' is not accepted. Should be "'.Person::GENRE_MAN
|
||||
.'" or "'.Person::GENRE_WOMAN.'"');
|
||||
.$terms['gender'].' is not accepted. Should be "'.Person::MALE_GENDER
|
||||
.'" or "'.Person::FEMALE_GENDER.'"');
|
||||
}
|
||||
|
||||
$qb->andWhere($qb->expr()->eq('p.genre', ':gender'))
|
||||
$qb->andWhere($qb->expr()->eq('p.gender', ':gender'))
|
||||
->setParameter('gender', $terms['gender']);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ trait PreparePersonTrait
|
||||
* Properties added are :
|
||||
* - firstname
|
||||
* - lastname
|
||||
* - genre
|
||||
* - gender
|
||||
*
|
||||
* This person should not be persisted in a database
|
||||
*
|
||||
@ -49,7 +49,7 @@ trait PreparePersonTrait
|
||||
->setCenter($center)
|
||||
->setFirstName('test firstname')
|
||||
->setLastName('default lastname')
|
||||
->setGenre(Person::GENRE_MAN)
|
||||
->setGender(Person::MALE_GENDER)
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Controller;
|
||||
|
||||
ini_set('memory_limit', '-1');
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
@ -84,7 +86,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
->setFirstName('Roland')
|
||||
->setLastName('Gallorime')
|
||||
->setCenter($center)
|
||||
->setGenre(Person::GENRE_MAN);
|
||||
->setGender(Person::MALE_GENDER);
|
||||
|
||||
static::$em->persist($this->person);
|
||||
static::$em->flush();
|
||||
|
@ -33,8 +33,8 @@ class PersonControllerCreateTest extends WebTestCase
|
||||
|
||||
const FIRSTNAME_INPUT = 'chill_personbundle_person_creation[firstName]';
|
||||
const LASTNAME_INPUT = "chill_personbundle_person_creation[lastName]";
|
||||
const GENRE_INPUT = "chill_personbundle_person_creation[genre]";
|
||||
const DATEOFBIRTH_INPUT = "chill_personbundle_person_creation[dateOfBirth]";
|
||||
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]";
|
||||
|
||||
@ -62,9 +62,9 @@ class PersonControllerCreateTest extends WebTestCase
|
||||
{
|
||||
$creationForm->get(self::FIRSTNAME_INPUT)->setValue($firstname);
|
||||
$creationForm->get(self::LASTNAME_INPUT)->setValue($lastname);
|
||||
$creationForm->get(self::GENRE_INPUT)->select("man");
|
||||
$creationForm->get(self::GENDER_INPUT)->select("man");
|
||||
$date = new \DateTime('1947-02-01');
|
||||
$creationForm->get(self::DATEOFBIRTH_INPUT)->setValue($date->format('d-m-Y'));
|
||||
$creationForm->get(self::BIRTHDATE_INPUT)->setValue($date->format('d-m-Y'));
|
||||
|
||||
return $creationForm;
|
||||
}
|
||||
@ -90,14 +90,14 @@ class PersonControllerCreateTest extends WebTestCase
|
||||
'The page contains a "firstname" input');
|
||||
$this->assertTrue($form->has(self::LASTNAME_INPUT),
|
||||
'The page contains a "lastname" input');
|
||||
$this->assertTrue($form->has(self::GENRE_INPUT),
|
||||
$this->assertTrue($form->has(self::GENDER_INPUT),
|
||||
'The page contains a "gender" input');
|
||||
$this->assertTrue($form->has(self::DATEOFBIRTH_INPUT),
|
||||
$this->assertTrue($form->has(self::BIRTHDATE_INPUT),
|
||||
'The page has a "date of birth" input');
|
||||
$this->assertTrue($form->has(self::CREATEDATE_INPUT),
|
||||
'The page contains a "creation date" input');
|
||||
|
||||
$genderType = $form->get(self::GENRE_INPUT);
|
||||
$genderType = $form->get(self::GENDER_INPUT);
|
||||
$this->assertEquals('radio', $genderType->getType(),
|
||||
'The gender input has two radio button: man and women');
|
||||
$this->assertEquals(2, count($genderType->availableOptionValues()),
|
||||
@ -154,7 +154,7 @@ class PersonControllerCreateTest extends WebTestCase
|
||||
public function testGenderIsNull(Form $form)
|
||||
{
|
||||
$this->fillAValidCreationForm($form);
|
||||
$form->get(self::GENRE_INPUT)->disableValidation()->setValue(NULL);
|
||||
$form->get(self::GENDER_INPUT)->disableValidation()->setValue(NULL);
|
||||
$crawler = $this->getAuthenticatedClient()->submit($form);
|
||||
|
||||
$this->assertEquals(1, $crawler->filter('.error')->count(),
|
||||
|
@ -67,7 +67,7 @@ class PersonControllerUpdateTest extends WebTestCase
|
||||
->setLastName("My Beloved")
|
||||
->setFirstName("Jesus")
|
||||
->setCenter($center)
|
||||
->setGenre(Person::GENRE_MAN);
|
||||
->setGender(Person::MALE_GENDER);
|
||||
|
||||
$this->em->persist($this->person);
|
||||
$this->em->flush();
|
||||
@ -229,18 +229,18 @@ class PersonControllerUpdateTest extends WebTestCase
|
||||
['firstName', 'random Value', function(Person $person) { return $person->getFirstName(); } ],
|
||||
['lastName' , 'random Value', function(Person $person) { return $person->getLastName(); } ],
|
||||
['placeOfBirth', 'none place', function(Person $person) { return $person->getPlaceOfBirth(); }],
|
||||
['dateOfBirth', '15-12-1980', function(Person $person) { return $person->getDateOfBirth()->format('d-m-Y'); }],
|
||||
['birthdate', '15-12-1980', function(Person $person) { return $person->getBirthdate()->format('d-m-Y'); }],
|
||||
['phonenumber', '0123456789', function(Person $person) { return $person->getPhonenumber(); }],
|
||||
['memo', 'jfkdlmq jkfldmsq jkmfdsq', function(Person $person) { return $person->getMemo(); }],
|
||||
['countryOfBirth', 'BE', function(Person $person) { return $person->getCountryOfBirth()->getCountryCode(); }],
|
||||
['nationality', 'FR', function(Person $person) { return $person->getNationality()->getCountryCode(); }],
|
||||
['placeOfBirth', '', function(Person $person) { return $person->getPlaceOfBirth(); }],
|
||||
['dateOfBirth', '', function(Person $person) { return $person->getDateOfBirth(); }],
|
||||
['birthdate', '', function(Person $person) { return $person->getBirthdate(); }],
|
||||
['phonenumber', '', function(Person $person) { return $person->getPhonenumber(); }],
|
||||
['memo', '', function(Person $person) { return $person->getMemo(); }],
|
||||
['countryOfBirth', NULL, function(Person $person) { return $person->getCountryOfBirth(); }],
|
||||
['nationality', NULL, function(Person $person) { return $person->getNationality(); }],
|
||||
['genre', Person::GENRE_WOMAN, function(Person $person) { return $person->getGenre(); }]
|
||||
['gender', Person::FEMALE_GENDER, function(Person $person) { return $person->getGender(); }]
|
||||
);
|
||||
}
|
||||
|
||||
@ -251,7 +251,7 @@ class PersonControllerUpdateTest extends WebTestCase
|
||||
['lastName', $this->getVeryLongText()],
|
||||
['firstName', ''],
|
||||
['lastName', ''],
|
||||
['dateOfBirth', 'false date']
|
||||
['birthdate', 'false date']
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ class PersonControllerViewTest extends WebTestCase
|
||||
->setLastName("Tested Person")
|
||||
->setFirstName("Réginald")
|
||||
->setCenter($center)
|
||||
->setGenre(Person::GENRE_MAN);
|
||||
->setGender(Person::MALE_GENDER);
|
||||
|
||||
$this->em->persist($this->person);
|
||||
$this->em->flush();
|
||||
|
@ -1,6 +1,9 @@
|
||||
imports:
|
||||
- { resource: parameters.yml }
|
||||
|
||||
parameters:
|
||||
locale: en
|
||||
|
||||
framework:
|
||||
secret: Not very secret
|
||||
router: { resource: "%kernel.root_dir%/config/routing.yml" }
|
||||
|
@ -138,7 +138,7 @@ class PersonSearchTest extends WebTestCase
|
||||
"assert clause firstname and nationality are AND");
|
||||
}
|
||||
|
||||
public function testSearchDateOfBirth()
|
||||
public function testSearchBirthdate()
|
||||
{
|
||||
$crawler = $this->generateCrawlerForSearch('@person birthdate:1948-12-27');
|
||||
|
||||
@ -146,7 +146,7 @@ class PersonSearchTest extends WebTestCase
|
||||
$this->assertRegExp('/Bart/', $crawler->text());
|
||||
}
|
||||
|
||||
public function testSearchCombineDateOfBirthAndFirstName()
|
||||
public function testSearchCombineBirthdateAndFirstName()
|
||||
{
|
||||
$crawler = $this->generateCrawlerForSearch('@person birthdate:1948-12-27 firstname:(Van Snick)');
|
||||
|
||||
@ -154,7 +154,7 @@ class PersonSearchTest extends WebTestCase
|
||||
$this->assertNotRegExp('/Depardieu/', $crawler->text());
|
||||
}
|
||||
|
||||
public function testSearchCombineGenreAndFirstName()
|
||||
public function testSearchCombineGenderAndFirstName()
|
||||
{
|
||||
$crawler = $this->generateCrawlerForSearch('@person gender:woman firstname:(Depardieu)');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user