| 
				
			 | 
			
			
				@@ -6,15 +6,31 @@ use Admingenerated\MuzichAdminBundle\BaseAdmin_elementController\EditController 
			 | 
		
	
		
			
			| 
				6
			 | 
			
				6
			 | 
			
			
				 use Symfony\Component\Form\Form; 
			 | 
		
	
		
			
			| 
				7
			 | 
			
				7
			 | 
			
			
				 use Muzich\CoreBundle\Entity\Element; 
			 | 
		
	
		
			
			| 
				8
			 | 
			
				8
			 | 
			
			
				 use Muzich\CoreBundle\Managers\ElementManager; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				9
			 | 
			
			
				+use Symfony\Component\HttpFoundation\RedirectResponse; 
			 | 
		
	
		
			
			| 
				9
			 | 
			
				10
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				10
			 | 
			
				11
			 | 
			
			
				 class EditController extends BaseEditController 
			 | 
		
	
		
			
			| 
				11
			 | 
			
				12
			 | 
			
			
				 { 
			 | 
		
	
		
			
			| 
				12
			 | 
			
				13
			 | 
			
			
				    
			 | 
		
	
		
			
			| 
				13
			 | 
			
				
			 | 
			
			
				-  public function preSave(Form $form, Element $Element) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				14
			 | 
			
			
				+  protected function getElementContext($pk) 
			 | 
		
	
		
			
			| 
				14
			 | 
			
				15
			 | 
			
			
				   { 
			 | 
		
	
		
			
			| 
				15
			 | 
			
				
			 | 
			
			
				-    //$em = $this->get('doctrine')->getEntityManager(); 
			 | 
		
	
		
			
			| 
				16
			 | 
			
				
			 | 
			
			
				-    //$factory = new ElementManager($Element, $em, $this->container); 
			 | 
		
	
		
			
			| 
				17
			 | 
			
				
			 | 
			
			
				-    //$factory->proceedFill($Element->getOwner(), false); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				16
			 | 
			
			
				+    $Element = $this->getObject($pk); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				17
			 | 
			
			
				+    if (!$Element) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				18
			 | 
			
			
				+        throw new NotFoundHttpException("The Muzich\CoreBundle\Entity\Element with id $pk can't be found"); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				19
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				20
			 | 
			
			
				+    return $Element; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				21
			 | 
			
			
				+  } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				22
			 | 
			
			
				+   
			 | 
		
	
		
			
			| 
				
			 | 
			
				23
			 | 
			
			
				+  public function regenerateAction($pk) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				24
			 | 
			
			
				+  { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				25
			 | 
			
			
				+    $Element = $this->getElementContext($pk); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				26
			 | 
			
			
				+    $em = $this->getDoctrine()->getManager(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				27
			 | 
			
			
				+    $factory = new ElementManager($Element, $em, $this->container); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				28
			 | 
			
			
				+    $factory->regenerate(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				29
			 | 
			
			
				+    $em->persist($Element); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				30
			 | 
			
			
				+    $em->flush(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				31
			 | 
			
			
				+     
			 | 
		
	
		
			
			| 
				
			 | 
			
				32
			 | 
			
			
				+    $this->get('session')->setFlash('success', $this->get('translator')->trans("object.edit.success", array(), 'Admingenerator') ); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				33
			 | 
			
			
				+    return new RedirectResponse($this->generateUrl("Muzich_AdminBundle_Admin_element_list" )); 
			 | 
		
	
		
			
			| 
				18
			 | 
			
				34
			 | 
			
			
				   } 
			 | 
		
	
		
			
			| 
				19
			 | 
			
				35
			 | 
			
			
				    
			 | 
		
	
		
			
			| 
				20
			 | 
			
				36
			 | 
			
			
				 } 
			 |