public function getRootsAsArray($id = null)
 {
     $criteria = Criteria::create()->where(Criteria::expr()->isNull('parent'));
     if ($id) {
         $criteria->andWhere(Criteria::expr()->neq('id', $id));
     }
     $list = parent::matching($criteria);
     $res = array();
     foreach ($list as $element) {
         $res[$element->getId()] = $element->getName();
     }
     return $res;
 }
 public function getSortedWidgets(array $groupValues = [])
 {
     $qb = parent::getBySortableGroupsQueryBuilder($groupValues)->select('n', 'w')->leftJoin('n.widget', 'w');
     return $qb->getQuery();
 }
 public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
 {
     $orderBy['weight'] = 'ASC';
     return parent::findBy($criteria, $orderBy, $limit, $offset);
 }