Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
technobel.sf
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mathieu
technobel.sf
Commits
730f14ed
Commit
730f14ed
authored
May 19, 2018
by
Mat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ajoute une contrainte sur les champs, on déclenche bien une 400
il manquait un use dans le controller
parent
37c0a30b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
6 deletions
+23
-6
src/APIBundle/Controller/OwnerAPIController.php
src/APIBundle/Controller/OwnerAPIController.php
+1
-0
src/APIBundle/Form/Owner/OwnerAPIType.php
src/APIBundle/Form/Owner/OwnerAPIType.php
+1
-1
src/TechnoBundle/Entity/Owner.php
src/TechnoBundle/Entity/Owner.php
+13
-0
src/TechnoBundle/Resources/views/Ajax/Owner/mainDisplay.html.twig
...noBundle/Resources/views/Ajax/Owner/mainDisplay.html.twig
+8
-5
No files found.
src/APIBundle/Controller/OwnerAPIController.php
View file @
730f14ed
...
...
@@ -2,6 +2,7 @@
namespace
APIBundle\Controller
;
use
Symfony\Component\HttpFoundation\Response
;
use
Symfony\Component\HttpFoundation\JsonResponse
;
use
Symfony\Component\HttpFoundation\Request
;
use
APIBundle\Form\Owner\OwnerAPIType
;
...
...
src/APIBundle/Form/Owner/OwnerAPIType.php
View file @
730f14ed
...
...
@@ -19,7 +19,7 @@ class OwnerAPIType extends OwnerType
// ok, on met ça en développement, le temps de régler
// les validations au niveau des Asserts, des FormType,
// qd c'est réglé, on vire cette option !!!
(false)
// qd c'est réglé, on vire cette option !!!
$resolver
->
setDefault
(
'attr'
,
array
(
'novalidate'
=>
true
));
}
...
...
src/TechnoBundle/Entity/Owner.php
View file @
730f14ed
...
...
@@ -4,6 +4,7 @@ namespace TechnoBundle\Entity;
use
Doctrine\ORM\Mapping
as
ORM
;
use
Doctrine\Common\Collections\ArrayCollection
;
use
Symfony\Component\Validator\Constraints
as
Assert
;
/**
* Owner
...
...
@@ -27,6 +28,12 @@ class Owner
* @var string
*
* @ORM\Column(name="Lastname", type="string", length=100)
* @Assert\Length(
* min = 3,
* max = 50,
* minMessage = "Your first name must be at least {{ limit }} characters long",
* maxMessage = "Your first name cannot be longer than {{ limit }} characters"
* )
*/
private
$lastname
;
...
...
@@ -34,6 +41,12 @@ class Owner
* @var string
*
* @ORM\Column(name="Firstname", type="string", length=100)
* @Assert\Length(
* min = 3,
* max = 50,
* minMessage = "Your first name must be at least {{ limit }} characters long",
* maxMessage = "Your first name cannot be longer than {{ limit }} characters"
* )
*/
private
$firstname
;
...
...
src/TechnoBundle/Resources/views/Ajax/Owner/mainDisplay.html.twig
View file @
730f14ed
...
...
@@ -195,10 +195,7 @@
form
.
addEventListener
(
'
submit
'
,
function
(
e
)
{
let
form
=
this
;
// Annule l'événement, mais préserve la fonction callback
e
.
preventDefault
();
e
.
preventDefault
();
// Annule l'événement, mais préserve la fonction callback
postAJAX
(
submitURL
,
function
()
{
if
(
this
.
readyState
===
4
)
...
...
@@ -209,7 +206,13 @@
form
.
parentNode
.
classList
.
add
(
'
hidden
'
);
}
else
if
(
this
.
status
===
400
)
{
console
.
log
(
'
BAD REQUEST. DISPLAY ERRORS
'
);
console
.
log
(
'
400 Bad Request
'
);
}
else
if
(
this
.
status
===
404
)
{
console
.
log
(
'
404 Not Found
'
);
}
else
if
(
this
.
status
===
500
)
{
console
.
log
(
'
500 Internal Server Error
'
);
}
}
...
...
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