Advertisement
Guest User

Untitled

a guest
Jun 6th, 2012
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Coddict\WebsiteBundle\Controller;
  4.  
  5. use Symfony\Bundle\FrameworkBundle\Controller\Controller,
  6.     Symfony\Component\HttpFoundation\Response,
  7.     Sonata\BlockBundle\Model\BlockInterface;
  8.  
  9.  
  10. class PageController extends Controller
  11. {
  12.     public function renderAction($contentDocument = null)    {
  13.                
  14.     //This line alone returns null
  15.     $contentDocument->category;
  16.  
  17.     //But if i get the page from the manager first, it works...
  18.     //This line works
  19.  
  20.     $dm = $this->get('doctrine_phpcr')->getManager();
  21.     $dm->find(null,$contentDocument->path);
  22.     //returns the category
  23.     $contentDocument->category;
  24.  
  25.  
  26.         return $this->render("::categorypage.html.twig",array("category" => $contentDocument->category, "page" => $contentDocument));  
  27.     }
  28.    
  29.    
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement