mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Renaming genre into gender & dateOfBirth into birthdate
This commit is contained in:
@@ -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">
|
||||
|
Reference in New Issue
Block a user