Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jun 6th, 2012  |  syntax: PHP  |  size: 0.77 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }