1313
1414namespace Zikula \ProfileModule \Controller ;
1515
16+ use Doctrine \Persistence \ManagerRegistry ;
1617use Sensio \Bundle \FrameworkExtraBundle \Configuration \Template ;
1718use Symfony \Component \HttpFoundation \RedirectResponse ;
1819use Symfony \Component \HttpFoundation \Request ;
@@ -52,7 +53,7 @@ public function listProperties(PropertyRepositoryInterface $propertyRepository):
5253 *
5354 * @return array|RedirectResponse
5455 */
55- public function edit (Request $ request , PropertyEntity $ propertyEntity = null )
56+ public function edit (Request $ request , ManagerRegistry $ doctrine , PropertyEntity $ propertyEntity = null )
5657 {
5758 if (!isset ($ propertyEntity )) {
5859 $ propertyEntity = new PropertyEntity ();
@@ -62,8 +63,8 @@ public function edit(Request $request, PropertyEntity $propertyEntity = null)
6263 if ($ form ->isSubmitted () && $ form ->isValid ()) {
6364 if ($ form ->get ('save ' )->isClicked ()) {
6465 $ propertyEntity = $ form ->getData ();
65- $ this -> getDoctrine () ->getManager ()->persist ($ propertyEntity );
66- $ this -> getDoctrine () ->getManager ()->flush ();
66+ $ doctrine ->getManager ()->persist ($ propertyEntity );
67+ $ doctrine ->getManager ()->flush ();
6768 $ this ->addFlash ('success ' , $ this ->trans ('Property saved. ' ));
6869 }
6970 if ($ form ->get ('cancel ' )->isClicked ()) {
@@ -85,15 +86,15 @@ public function edit(Request $request, PropertyEntity $propertyEntity = null)
8586 *
8687 * @return array|RedirectResponse
8788 */
88- public function delete (Request $ request , PropertyEntity $ propertyEntity )
89+ public function delete (Request $ request , ManagerRegistry $ doctrine , PropertyEntity $ propertyEntity )
8990 {
9091 $ form = $ this ->createForm (DeletionType::class, $ propertyEntity );
9192 $ form ->handleRequest ($ request );
9293 if ($ form ->isSubmitted () && $ form ->isValid ()) {
9394 if ($ form ->get ('delete ' )->isClicked ()) {
9495 $ propertyEntity = $ form ->getData ();
95- $ this -> getDoctrine () ->getManager ()->remove ($ propertyEntity );
96- $ this -> getDoctrine () ->getManager ()->flush ();
96+ $ doctrine ->getManager ()->remove ($ propertyEntity );
97+ $ doctrine ->getManager ()->flush ();
9798 $ this ->addFlash ('success ' , $ this ->trans ('Property removed. ' ));
9899 }
99100 if ($ form ->get ('cancel ' )->isClicked ()) {
0 commit comments