| @@ 10958-10975 (lines=18) @@ | ||
| 10955 | * |
|
| 10956 | * @return mixed |
|
| 10957 | */ |
|
| 10958 | public static function getCategories($courseId) |
|
| 10959 | { |
|
| 10960 | $em = Database::getManager(); |
|
| 10961 | //Default behaviour |
|
| 10962 | /*$items = $em->getRepository('ChamiloCourseBundle:CLpCategory')->findBy( |
|
| 10963 | array('cId' => $course_id), |
|
| 10964 | array('name' => 'ASC') |
|
| 10965 | );*/ |
|
| 10966 | ||
| 10967 | // Using doctrine extensions |
|
| 10968 | /** @var SortableRepository $repo */ |
|
| 10969 | $repo = $em->getRepository('ChamiloCourseBundle:CLpCategory'); |
|
| 10970 | $items = $repo |
|
| 10971 | ->getBySortableGroupsQuery(['cId' => $courseId]) |
|
| 10972 | ->getResult(); |
|
| 10973 | ||
| 10974 | return $items; |
|
| 10975 | } |
|
| 10976 | ||
| 10977 | /** |
|
| 10978 | * @param int $id |
|
| @@ 10994-11000 (lines=7) @@ | ||
| 10991 | * @param int $courseId |
|
| 10992 | * @return array |
|
| 10993 | */ |
|
| 10994 | public static function getCategoryByCourse($courseId) |
|
| 10995 | { |
|
| 10996 | $em = Database::getManager(); |
|
| 10997 | $items = $em->getRepository('ChamiloCourseBundle:CLpCategory')->findBy( |
|
| 10998 | array('cId' => $courseId) |
|
| 10999 | ); |
|
| 11000 | ||
| 11001 | return $items; |
|
| 11002 | } |
|
| 11003 | ||