| @@ 11012-11029 (lines=18) @@ | ||
| 11009 | * |
|
| 11010 | * @return mixed |
|
| 11011 | */ |
|
| 11012 | public static function getCategories($courseId) |
|
| 11013 | { |
|
| 11014 | $em = Database::getManager(); |
|
| 11015 | //Default behaviour |
|
| 11016 | /*$items = $em->getRepository('ChamiloCourseBundle:CLpCategory')->findBy( |
|
| 11017 | array('cId' => $course_id), |
|
| 11018 | array('name' => 'ASC') |
|
| 11019 | );*/ |
|
| 11020 | ||
| 11021 | // Using doctrine extensions |
|
| 11022 | /** @var SortableRepository $repo */ |
|
| 11023 | $repo = $em->getRepository('ChamiloCourseBundle:CLpCategory'); |
|
| 11024 | $items = $repo |
|
| 11025 | ->getBySortableGroupsQuery(['cId' => $courseId]) |
|
| 11026 | ->getResult(); |
|
| 11027 | ||
| 11028 | return $items; |
|
| 11029 | } |
|
| 11030 | ||
| 11031 | /** |
|
| 11032 | * @param int $id |
|
| @@ 11048-11054 (lines=7) @@ | ||
| 11045 | * @param int $courseId |
|
| 11046 | * @return array |
|
| 11047 | */ |
|
| 11048 | public static function getCategoryByCourse($courseId) |
|
| 11049 | { |
|
| 11050 | $em = Database::getManager(); |
|
| 11051 | $items = $em->getRepository('ChamiloCourseBundle:CLpCategory')->findBy( |
|
| 11052 | array('cId' => $courseId) |
|
| 11053 | ); |
|
| 11054 | ||
| 11055 | return $items; |
|
| 11056 | } |
|
| 11057 | ||