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

getRecordAction() public method

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