2017-10-09 39 views
0

我得到這個:試圖調用名爲「getQuery」類的一個未定義的方法「EntidadesBundle 實體角色」

public function getRolByIdAction(Request $request) 
    { 

     try{ 

      $inicio = $this->get("app.Ensession"); 

      if($inicio->logeado($this) === true && $inicio->ver_rol("sistemas") && $request->getMethod() == "POST"){ 

       $filtro_busqueda = $request->get("filtro")["filtro"]; 

       $roles = $this->getDoctrine()->getRepository('EntidadesBundle:Roles')->find($filtro_busqueda); 

       if($roles){ 

        $response = new JsonResponse(
         array(
          'error' => false, 
          'data' => ***$roles->getQuery()->getArrayResult()*** 
         ) 
        ); 

       }else{ 
        new ErrorException(ErrorException::CONSULTA_SIN_RESULTADOS); 
       } 

      }else{ 
       return $inicio->logeado($this); 
      } 

      return $response; 

     } catch (\Exception $e) { 

      $response = new JsonResponse(
       array(
        'error' => true, 
        'mensaje' => "Error " . $e->getCode() . " -> " . $e->getMessage() 
        ) 
       ); 

      return $response; 
     } 
    } 

的問題是,我不知道我必須做的,發送的$角色行,我發現

我發送了

POST參數 核心價值 filtro

[▼「filtro」 =>「1」]

我可以返回從查找查詢學說JSON模式?是symfony3,我沒有@ ORM /編號在我Entity/roles.php

回答

相關問題