Skip to content

Instantly share code, notes, and snippets.

@SofHad
Created August 6, 2013 20:36
Show Gist options
  • Save SofHad/6168362 to your computer and use it in GitHub Desktop.
Save SofHad/6168362 to your computer and use it in GitHub Desktop.
initialize Symfony Controller
public function initializeAction() {
$this->doctrine = $this->getDoctrine();
$this->bundle = $this->container->getParameter("bundle");
$this->entityManager = $this->doctrine->getEntityManager();
$this->productRepository = $this->doctrine->getRepository($this->bundle . ':Product');
$this->categoryRepository = $this->doctrine->getRepository($this->bundle . ':Category');
$this->categoryModel = $categoryModel = $this->get("CategoryModel");
$this->productModel = $this->get("ProductModel");
//Menu
$this->menu["menu"] = $this->get("menu");
$this->menu["main_menu"] = $this->container->getParameter('menu')["main_menu"];
$this->menu["active_menu"] = $this->container->getParameter("active_menu");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment