Created
November 20, 2016 12:29
-
-
Save JavierCane/64942ac32c828dcf010985f3c5275e82 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AppBundle\Controller; | |
use FOS\RestBundle\Controller\FOSRestController; | |
use Symfony\Component\HttpFoundation\Request; | |
final class CourseController extends FOSRestController | |
{ | |
public function getCourseAction(Request $request) | |
{ | |
return $this->getDoctrine() | |
->getEntityManager() | |
->createQueryBuilder() | |
->select('c', 'v') | |
->from('AppBundle\Model\Course', 'c') | |
->where('c.level', '>', $request->get('from_level', 0)) | |
->getQuery() | |
->execute(); | |
} | |
public function getCourseVideosAction($courseId) | |
{ | |
return $this->getDoctrine() | |
->getEntityManager() | |
->createQueryBuilder() | |
->select('c', 'v') | |
->from('AppBundle\Model\Course', 'c') | |
->leftJoin('a.Video', 'v') | |
->where('c.id', '=', $courseId) | |
->getQuery() | |
->execute(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment