Chyba pri where podmienke v Datagride
- KristianSubweb
- Člen | 146
Ahojte mám taký problém. V datagride k jednotlivému riadku potrebujem dostať všetkých userov ktorý su pridelený k danym riadkom v tabulke.
$grid->addColumnText("user", "is.projects.tester")
->setRenderer(function(ActiveRow $item) {
$columns = $item->getTable()->select(":test_plan_sprint_case_user.user.id AS userID,
CONCAT(:test_plan_sprint_case_user.user.name, ' ',:test_plan_sprint_case_user.user.surname) AS testerName")
->where(":test_plan_sprint_case_user.test_plan_sprint_case_id=" . $item["id"])
->order("userID ASC")
->fetchPairs("userID", "testerName");
unset($columns[""]);
$testers = join(", ", $columns);
return $testers;
});
Ked kuknem v tracy ako vyzerá select:
SELECT `test_plan_sprint_case`.`id`,
`test_plan`.`name` AS `testPlanID`,
`test_plan_sprint`.`name` AS `testPlanSprintID`,
`test_case`.`name` AS `testCaseName`,
`test_set`.`name` AS `testSetName`,
`forced_status_id` AS `forcedStatusID`,
`test_case`.`priority` AS `priority`,
`status_id`, `forced_status_id`, `user`.`id` AS `userID`,
CONCAT(`user`.`name`, ' ',`user`.`surname`) AS `testerName`, `user`.`id` AS `userID`,
CONCAT(`user`.`name`, ' ',`user`.`surname`) AS `testerName`, `user`.`id` AS `userID`,
CONCAT(`user`.`name`, ' ',`user`.`surname`) AS `testerName`, `user`.`id` AS `userID`,
CONCAT(`user`.`name`, ' ',`user`.`surname`) AS `testerName`, `user`.`id` AS `userID`,
CONCAT(`user`.`name`, ' ',`user`.`surname`) AS `testerName`, `user`.`id` AS `userID`,
CONCAT(`user`.`name`, ' ',`user`.`surname`) AS `testerName`, `user`.`id` AS `userID`,
CONCAT(`user`.`name`, ' ',`user`.`surname`) AS `testerName`, `user`.`id` AS `userID`,
CONCAT(`user`.`name`, ' ',`user`.`surname`) AS `testerName`
FROM `test_plan_sprint_case`
LEFT JOIN `test_plan_sprint_case_user` ON `test_plan_sprint_case`.`id` =
`test_plan_sprint_case_user`.`test_plan_sprint_case_id`
LEFT JOIN `test_plan_sprint` ON `test_plan_sprint_case`.`test_plan_sprint_id` =
`test_plan_sprint`.`id`
LEFT JOIN `test_plan` ON `test_plan_sprint`.`test_plan_id` = `test_plan`.`id`
LEFT JOIN `test_plan_case` ON `test_plan_sprint_case`.`test_plan_case_id` = `test_plan_case`.`id`
LEFT JOIN `test_case` ON `test_plan_case`.`test_case_id` = `test_case`.`id`
LEFT JOIN `test_set` ON `test_case`.`test_set_id` = `test_set`.`id`
LEFT JOIN `user` ON `test_plan_sprint_case_user`.`user_id` = `user`.`id`
WHERE (`test_plan_sprint_case`.`test_plan_sprint_id` = '194') AND
(`test_plan_sprint_case_user`.`test_plan_sprint_case_id`=6519) AND
(`test_plan_sprint_case_user`.`test_plan_sprint_case_id`=6518) AND
(`test_plan_sprint_case_user`.`test_plan_sprint_case_id`=6517) AND
(`test_plan_sprint_case_user`.`test_plan_sprint_case_id`=6516) AND
(`test_plan_sprint_case_user`.`test_plan_sprint_case_id`=6515) AND
(`test_plan_sprint_case_user`.`test_plan_sprint_case_id`=6514) AND
(`test_plan_sprint_case_user`.`test_plan_sprint_case_id`=6513) AND
(`test_plan_sprint_case_user`.`test_plan_sprint_case_id`=6512)
ORDER BY `id` DESC, `userID` ASC, `userID` ASC, `userID` ASC, `userID` ASC, `userID` ASC, `userID`
ASC, `userID` ASC, `userID` ASC
LIMIT 10
A tým že pridá do tej where podmienky AND tak mi nájde len prvého a na ostatné sa vykašle. Hádam budete vedieť poradiť. DIk
Editoval KristianSubweb (16. 7. 2018 9:55)