Guest User

Untitled

a guest
Apr 7th, 2011
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Application\UserBundle\Controller;
  4.  
  5. use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  6.  
  7. class HelloController extends Controller
  8. {
  9.     public function indexAction($name)
  10.     {
  11.      
  12.         $country = new \Application\LocationBundle\Document\Country();
  13.         $country->setName($name);
  14.  
  15.         $dm   = $this->get('doctrine.odm.mongodb.document_manager');
  16.         $sdm  = $this->get('doctrine.odm.mongodb.soft_delete.manager');
  17.  
  18.         // save country with document manager
  19.         $dm->persist($country);
  20.         $dm->flush();
  21.  
  22.         // delete country with soft delete manager
  23.         $sdm->delete($country);
  24.         $sdm->flush();
  25.  
  26.         return $this->render('ApplicationUserBundle:Hello:index.html.twig', array('name' => $name));
  27.        
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment