add email and phonenumber: wrote migration file, changed templates, changed validation rules

This commit is contained in:
nobohan
2018-05-18 17:41:33 +02:00
parent 3eb96c4479
commit e9698f2cbc
9 changed files with 118 additions and 16 deletions

View File

@@ -12,7 +12,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
*/
class Configuration implements ConfigurationInterface
{
private $validationBirthdateNotAfterInfos = "The period before today during which"
. " any birthdate is not allowed. The birthdate is expressed as ISO8601 : "
. "https://en.wikipedia.org/wiki/ISO_8601#Durations";
@@ -23,7 +23,7 @@ class Configuration implements ConfigurationInterface
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('cl_chill_person');
$rootNode
->canBeDisabled()
->children()
@@ -50,14 +50,14 @@ class Configuration implements ConfigurationInterface
$interval = new \DateInterval($period);
} catch (\Exception $ex) {
return true;
}
}
return false;
})
->thenInvalid('Invalid period for birthdate validation : "%s" '
. 'The parameter should match duration as defined by ISO8601 : '
. 'https://en.wikipedia.org/wiki/ISO_8601#Durations')
->end() // birthdate_not_after, parent = children of validation
->end() // children for 'validation', parent = validation
->end() //validation, parent = children of root
->end() // children of root, parent = root
@@ -67,6 +67,8 @@ class Configuration implements ConfigurationInterface
->append($this->addFieldNode('place_of_birth'))
->append($this->addFieldNode('email'))
->append($this->addFieldNode('phonenumber'))
->append($this->addFieldNode('mobilenumber'))
->append($this->addFieldNode('contact_info'))
->append($this->addFieldNode('nationality'))
->append($this->addFieldNode('country_of_birth'))
->append($this->addFieldNode('marital_status'))
@@ -76,22 +78,22 @@ class Configuration implements ConfigurationInterface
->end() // person_fields, parent = children of root
->end() // children of 'root', parent = root
;
return $treeBuilder;
}
private function addFieldNode($key)
{
$tree = new TreeBuilder();
$node = $tree->root($key, 'enum');
$node
->values(array('hidden', 'visible'))
->defaultValue('visible')
->info("If the field $key must be shown")
->end();
return $node;
}
}