大家好我有问题,不知道该怎么做。
$cities = json_decode($request->get('cities'), true); // if return i get The controller must return a response (Array(0 => 'VLN', 1 => 'KNS') given)
控制器:
Array(0 => 'VLN', 1 => 'KNS')
如果我得到了这个响应$cities
并投入功能我得到了我需要的好结果。但是如果我把变量$cities = json_decode($request->get('cities'), true);
if(!empty($cities)){
$orders = $this->getDoctrine()->getEntityManager()
->getRepository('AppBundle:OrderWork')
->getOrderCityByPrefix([0 => 'VLN', 1 => 'KNS']); // it's good
$orders = $this->getDoctrine()->getEntityManager()
->getRepository('AppBundle:OrderWork')
->getOrderCityByPrefix($cities); // bad
}
放到函数中我有空结果。
;WITH cte AS (
SELECT *
FROM (VALUES
('2016-01'),('2016-02'),('2017-01'),('2018-00')
) as t(A)
), cte1 AS (
SELECT *
FROM (VALUES
('2015-00'),('2015-01'),('2017-01'),('2018-01')
) as t(B)
)
SELECT c.A,
t.B
FROM cte c
CROSS APPLY (
SELECT TOP 1 B
FROM cte1
WHERE CAST(REPLACE(c.A,'-','') as int) >= CAST(REPLACE(B,'-','') as int)
ORDER BY B DESC
) t