Symfony用管道字符替换OR字

时间:2017-05-24 14:04:08

标签: symfony

Symfony正在我为我的API做的http调用中用管道符号(ROLE_MENU_SUPP | T_EDITION)替换我的参数值的OR字。这是一个堆栈跟踪

An exception occurred while executing 'SELECT t0.id AS id_1, t0.name AS 
nom_2 FROM roles t0 WHERE t0.name = ?' 
with params ["ROLE_MENU_SUPPORT_EDITION"]:

Execution failed for request: GET 
/app_dev.php/api/roles?name=ROLE_MENU_SUPP|T_EDITION 
HTTP/1.1: HTTPCode 204, body

以下是API方法:

    /**
 * @Rest\View(statusCode=Response::HTTP_NO_CONTENT)
 * @Rest\Get("/roles")
 */
public function getAllEntitiesAction(Request $request)
{
    $filtre = array();

    if ($request->get("name")) {
        $filtre = array(
            'name' => $request->get("name")
        );
    }
    $em = $this->getDoctrine()->getManager();

    return $em->getRepository($this->entity)->findBy($filtre);
}

1 个答案:

答案 0 :(得分:0)

将ROLE_MENU_SUPPORT_EDITION放入cuotes