Skip to content

Instantly share code, notes, and snippets.

@veloxy
Last active November 20, 2015 20:07
Show Gist options
  • Save veloxy/d70e39ba7074a529942b to your computer and use it in GitHub Desktop.
Save veloxy/d70e39ba7074a529942b to your computer and use it in GitHub Desktop.
Kunstmaan\MenuBundle\Entity\Menu:
main_navigation_{nl,en}:
name: "Main Navigation"
locale: <current()>
Kunstmaan\MenuBundle\Entity\MenuItem:
home_menu_item_{nl,en}:
type: page_link
menu: @main_navigation_<current()>
# Everything goes fine until here, current is not being passed correctly for some reason
# tried with current(), <current()>, 'current()', '<current()>' but nothing seems to work.
nodetranslation: <getTranslationByInternalName('homepage', <current()>)>
<?php
namespace Kunstmaan\FixturesBundle\Provider;
use Doctrine\ORM\EntityManager;
class NodeTranslation
{
private $nodeTransRepo;
public function __construct(EntityManager $em)
{
$this->nodeTransRepo = $em->getRepository('KunstmaanNodeBundle:NodeTranslation');
}
public function getTranslationByTitle($title, $lang)
{
return $this->nodeTransRepo->findOneBy(array('title' => $title, 'lang' => $lang));
}
public function getTranslationByInternalName($name, $lang)
{
return $this->nodeTransRepo->getNodeTranslationByLanguageAndInternalName($lang, $name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment