Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mathieu
potage
Commits
e4a25baf
Commit
e4a25baf
authored
Jun 11, 2018
by
Mat
Browse files
Déplace/renomme -> OffreLegumesController/ajaxDisplayAction
parent
5bb5e543
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/PotageBundle/Controller/OffreController.php
View file @
e4a25baf
...
...
@@ -3,7 +3,6 @@
namespace
PotageBundle\Controller
;
use
APIBundle\Form\OffreAPIType
;
use
APIBundle\Form\OffreLegumesAPIType
;
class
OffreController
extends
MasterController
{
...
...
@@ -19,25 +18,4 @@ class OffreController extends MasterController
));
}
/**
* @param $id
* @return \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* @throws \Doctrine\ORM\NonUniqueResultException
*/
public
function
readOneAction
(
$id
)
{
$offre
=
$this
->
getDoctrine
()
->
getManager
()
->
getRepository
(
'PotageBundle:Offre'
)
->
findOneForAPIRead
(
$id
);
if
(
$offre
===
null
)
{
return
$this
->
createNotFoundException
(
'Non trouvé'
);
}
$form
=
$this
->
createForm
(
OffreLegumesAPIType
::
class
);
return
$this
->
render
(
'@Potage/OffreLegumes/ajaxDisplay.html.twig'
,
array
(
'id'
=>
$id
,
'offre'
=>
$offre
,
'formOffreLegumes'
=>
$form
->
createView
()
));
}
}
src/PotageBundle/Controller/OffreLegumesController.php
View file @
e4a25baf
...
...
@@ -2,11 +2,31 @@
namespace
PotageBundle\Controller
;
use
APIBundle\Form\OffreLegumesAPIType
;
class
OffreLegumesController
extends
MasterController
{
/**
* @param $id
* @return \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* @throws \Doctrine\ORM\NonUniqueResultException
*/
public
function
ajaxDisplayAction
(
$id
)
{
$offre
=
$this
->
getDoctrine
()
->
getManager
()
->
getRepository
(
'PotageBundle:Offre'
)
->
findOneForAPIRead
(
$id
);
if
(
$offre
===
null
)
{
return
$this
->
createNotFoundException
(
'Non trouvé'
);
}
$form
=
$this
->
createForm
(
OffreLegumesAPIType
::
class
);
return
$this
->
render
(
'@Potage/OffreLegumes/ajaxDisplay.html.twig'
,
array
(
'id'
=>
$id
,
'offre'
=>
$offre
,
'formOffreLegumes'
=>
$form
->
createView
()
));
}
}
src/PotageBundle/Resources/config/routing.yml
View file @
e4a25baf
...
...
@@ -22,6 +22,6 @@ potage_offre_legumes_ajax_display:
requirements
:
id
:
\d+
defaults
:
_controller
:
PotageBundle:Offre
:readOne
_controller
:
PotageBundle:Offre
Legumes:ajaxDisplay
methods
:
[
GET
]
Write
Preview
Supports
Markdown
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