Ojs\OAIBundle\Controller\DefaultController::getRecordAction PHP Method

getRecordAction() public method

public getRecordAction ( Request $request ) : Response
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response
    public function getRecordAction(Request $request)
    {
        $data = [];
        $identifier = $request->get('identifier');
        $base_host = $this->container->getParameter("base_host");
        preg_match_all('~oai:' . $base_host . ':((\\barticle\\b)|(\\brecord\\b))/(\\d+)~', $identifier, $matches);
        if (!isset($matches[4]) || !isset($matches[4][0])) {
            throw new NotFoundHttpException("Record not found.");
        }
        $id = $matches[4][0];
        /** @var EntityManager $em */
        $em = $this->getDoctrine()->getManager();
        $qb = $em->createQueryBuilder();
        $qb->select("a")->from("OjsJournalBundle:Article", "a");
        $qb->where($qb->expr()->eq("a.id", ":id"))->setParameter("id", $id);
        $data['record'] = $qb->getQuery()->getOneOrNullResult();
        if (!$data['record']) {
            throw new NotFoundHttpException("Record not found");
        }
        $data['metadataPrefix'] = $request->get('metadataPrefix', 'oai_dc');
        return $this->response('OjsOAIBundle:Default:record.xml.twig', $data);
    }