public function getCategoryTree()
{
$qb = $this->getRepository()->createQueryBuilder('pc')->select('c, pc')->leftJoin('pc.category', 'c')->where('pc.enabled = true')->andWhere('c.enabled = true')->groupBy('c.id');
$pCategories = $qb->getQuery()->execute();
$categoryTree = array();
foreach ($pCategories as $category) {
$this->putInTree($category->getCategory(), $categoryTree);
}
return $categoryTree;
}