标签云

微信群

扫码加入我们

WeChat QR Code

I have the following query:$qb ->select('z') ->where($qb->expr()->orX( $qb->expr()->like('z.city', ':czRequest') )) ->groupBy('z.city') ->setParameter('czRequest', $cz . '%');With $cz = 'Ber'I get an array like this:array:3 [ 0 => array:4[ "id" => 12899 "country" => "DE" "city" => "Berlin" "code" => 14199 ] 1 => array:4[ "id" => 6483 "country" => "DE" "city" => "Berlingen" "code" => 54570 ] 2 => array:4 [ "id" => 8438 "country" => "DE" "city" => "Berlingerode" "code" => 37339 ]]Now 'Berlin' gives more than one (zip) 'code', in this example '14199' is obviously only the last one. 'Berlingen' on the other hand only has one code.Is there any way to alter the query so that I have 'various' instead of '14199' but keep the others?It does not have to be in the query itself, I think maybe a 'foreach' for the query (w/out the groupBy) and check for duplicate cities?Any hint appreciated!