I have a simple problem but, i don't found how to resolve it, so i use Doctrine Behaviors to apply a system translation on my project, and Gedmo\Tree to apply the system of category left-right.
This is my action :
public function menuAction()
{
$em = $this->getDoctrine()->getManager();
$entityManager = $this->getDoctrine()->getManager();
$repo = $em->getRepository('ProductsBundle:Category');
$options = array(
'decorate' => true,
'rootOpen' => '<ul>',
'rootClose' => '</ul>',
'childOpen' => '<li>',
'childClose' => '</li>',
'representationField' => 'id',
'nodeDecorator' => function($node) {
return '<a href="category/'.$node['id'].'">'.$node['id'].'</a>';
}
);
$htmlTree = $repo->childrenHierarchy(
null,
false,
$options
);
// $tree = $repo->buildTree($query->getArrayResult(), $options);
$categories = $em->getRepository("ProductsBundle:Category")->getCategoryHiearchy();
return $this->render('ProductsBundle:Public:Category/menu.html.twig', array(
'categories' => $categories,
'htmlTree' => $htmlTree,
));
}
All what i want to do is, to change the name of my link, i set ID out of , and this is the result : http://snapplr.com/snap/mkmv
It work perfectyl, right now i want to get the feild Title from the Entity CategoryTranslation of doctrine behaviors.
Thank