Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
Chill-Person
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
11
Issues
11
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chill-project
Chill-Person
Commits
2f03f925
Commit
2f03f925
authored
May 14, 2018
by
Julien Minet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add mobilenumber + validation on email and phonenumber (regex)
parent
db00a0d2
Pipeline
#52081
failed with stages
in 1 minute and 33 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
146 additions
and
108 deletions
+146
-108
Entity/Person.php
Entity/Person.php
+133
-107
Form/PersonType.php
Form/PersonType.php
+2
-1
Resources/config/validation.yml
Resources/config/validation.yml
+11
-0
No files found.
Entity/Person.php
View file @
2f03f925
...
...
@@ -72,6 +72,9 @@ class Person implements HasCenterInterface {
/** @var string The person's phonenumber */
private
$phonenumber
=
''
;
/** @var string The person's mobile phone number */
private
$mobilenumber
=
''
;
//TO-ADD : caseOpeningDate
//TO-ADD nativeLanguag
...
...
@@ -603,6 +606,29 @@ class Person implements HasCenterInterface {
return
$this
->
phonenumber
;
}
/**
* Set mobilenumber
*
* @param string $mobilenumber
* @return Person
*/
public
function
setMobilenumber
(
$mobilenumber
=
''
)
{
$this
->
mobilenumber
=
$mobilenumber
;
return
$this
;
}
/**
* Get mobilenumber
*
* @return string
*/
public
function
getMobilenumber
()
{
return
$this
->
mobilenumber
;
}
public
function
__toString
()
{
return
$this
->
getLabel
();
...
...
Form/PersonType.php
View file @
2f03f925
...
...
@@ -27,6 +27,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
use
Symfony\Component\Form\Extension\Core\Type\TextareaType
;
use
Symfony\Component\Form\Extension\Core\Type\TextType
;
use
Symfony\Component\Form\Extension\Core\Type\DateType
;
use
Symfony\Component\Form\Extension\Core\Type\EmailType
;
use
Chill\PersonBundle\Form\Type\GenderType
;
use
Chill\MainBundle\Form\Type\Select2CountryType
;
...
...
@@ -80,7 +81,7 @@ class PersonType extends AbstractType
}
if
(
$this
->
config
[
'email'
]
===
'visible'
)
{
$builder
->
add
(
'email'
,
Textarea
Type
::
class
,
array
(
'required'
=>
false
));
$builder
->
add
(
'email'
,
Email
Type
::
class
,
array
(
'required'
=>
false
));
}
if
(
$this
->
config
[
'country_of_birth'
]
===
'visible'
)
{
...
...
Resources/config/validation.yml
View file @
2f03f925
...
...
@@ -30,6 +30,17 @@ Chill\PersonBundle\Entity\Person:
accompanyingPeriods
:
-
Valid
:
traverse
:
true
email
:
-
Email
:
groups
:
[
general
,
creation
]
message
:
'
The
email
"{{
value
}}"
is
not
a
valid
email.'
phonenumber
:
-
Regex
:
pattern
:
'
/^([\+{1}]|[0])([0-9\s*]{4,20})$/'
groups
:
[
general
,
creation
]
message
:
'
Invalid
phone
number:
it
should
begin
with
"0"
or
"+",
hold
only
digits
and
be
smaller
than
20
characters
'
constraints
:
-
Callback
:
callback
:
isAccompanyingPeriodValid
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment