(РЕШЕНО) Вывод Tickets вместе с комментариями

Нужен вывод тикетов на странице вместе с их комментариями.

тикет
комментарий
комментарий
тикет
комментарий


Тикеты вывожу стандартно.

[[!pdoPage? &element=`getTickets` ]] [[!+page.nav]]
в чанке тикета под ним вызываю

[[!getComments? &threads=`id`]],


надеюсь что выведутся комментарии только этого тикета, но выводятся только комментарии к текущему ресурсу, либо ничего если комментариев нет.
Как вывести комментарии тикета рядом с ним в pdopage?

UPD:
0.0000989: pdoTools loaded
0.0022759: Conditions prepared
0.0001569: Query parameters prepared.
0.0000339: xPDO query object created
0.0001769: innerJoined TicketThread as Thread
0.0001760: leftJoined modUser as User
0.0001631: leftJoined modUserProfile as Profile
0.0001681: leftJoined Ticket as Ticket
0.0001869: leftJoined TicketsSection as Section
0.0000031: Grouped by TicketComment.id
0.0000999: Added selection of TicketComment: SQL_CALC_FOUND_ROWS `id`, `thread`, `parent`, `text`, `name`, `email`, `ip`, `rating`, `rating_plus`, `rating_minus`, `createdon`, `createdby`, `editedon`, `editedby`, `published`, `deleted`, `deletedon`, `deletedby`, `properties`, `rating` as `rating_total`
0.0000181: Added selection of TicketThread: `resource`
0.0000198: Added selection of modUser: `username`
0.0000348: Added selection of modUserProfile: `internalKey`, `fullname`, `phone`, `mobilephone`, `blocked`, `blockeduntil`, `blockedafter`, `logincount`, `lastlogin`, `thislogin`, `failedlogincount`, `sessionid`, `dob`, `gender`, `address`, `country`, `city`, `state`, `zip`, `fax`, `photo`, `comment`, `website`, `extended`,`email` as `user_email`
0.0000610: Added selection of Ticket: `id` AS `ticket.id`, `type` AS `ticket.type`, `contentType` AS `ticket.contentType`, `pagetitle` AS `ticket.pagetitle`, `longtitle` AS `ticket.longtitle`, `description` AS `ticket.description`, `alias` AS `ticket.alias`, `link_attributes` AS `ticket.link_attributes`, `published` AS `ticket.published`, `pub_date` AS `ticket.pub_date`, `unpub_date` AS `ticket.unpub_date`, `parent` AS `ticket.parent`, `isfolder` AS `ticket.isfolder`, `introtext` AS `ticket.introtext`, `richtext` AS `ticket.richtext`, `template` AS `ticket.template`, `menuindex` AS `ticket.menuindex`, `searchable` AS `ticket.searchable`, `cacheable` AS `ticket.cacheable`, `createdby` AS `ticket.createdby`, `createdon` AS `ticket.createdon`, `editedby` AS `ticket.editedby`, `editedon` AS `ticket.editedon`, `deleted` AS `ticket.deleted`, `deletedon` AS `ticket.deletedon`, `deletedby` AS `ticket.deletedby`, `publishedon` AS `ticket.publishedon`, `publishedby` AS `ticket.publishedby`, `menutitle` AS `ticket.menutitle`, `donthit` AS `ticket.donthit`, `privateweb` AS `ticket.privateweb`, `privatemgr` AS `ticket.privatemgr`, `content_dispo` AS `ticket.content_dispo`, `hidemenu` AS `ticket.hidemenu`, `class_key` AS `ticket.class_key`, `context_key` AS `ticket.context_key`, `content_type` AS `ticket.content_type`, `uri` AS `ticket.uri`, `uri_override` AS `ticket.uri_override`, `hide_children_in_tree` AS `ticket.hide_children_in_tree`, `show_in_tree` AS `ticket.show_in_tree`, `properties` AS `ticket.properties`
0.0000651: Added selection of TicketsSection: `id` AS `section.id`, `type` AS `section.type`, `contentType` AS `section.contentType`, `pagetitle` AS `section.pagetitle`, `longtitle` AS `section.longtitle`, `description` AS `section.description`, `alias` AS `section.alias`, `link_attributes` AS `section.link_attributes`, `published` AS `section.published`, `pub_date` AS `section.pub_date`, `unpub_date` AS `section.unpub_date`, `parent` AS `section.parent`, `isfolder` AS `section.isfolder`, `introtext` AS `section.introtext`, `richtext` AS `section.richtext`, `template` AS `section.template`, `menuindex` AS `section.menuindex`, `searchable` AS `section.searchable`, `cacheable` AS `section.cacheable`, `createdby` AS `section.createdby`, `createdon` AS `section.createdon`, `editedby` AS `section.editedby`, `editedon` AS `section.editedon`, `deleted` AS `section.deleted`, `deletedon` AS `section.deletedon`, `deletedby` AS `section.deletedby`, `publishedon` AS `section.publishedon`, `publishedby` AS `section.publishedby`, `menutitle` AS `section.menutitle`, `donthit` AS `section.donthit`, `privateweb` AS `section.privateweb`, `privatemgr` AS `section.privatemgr`, `content_dispo` AS `section.content_dispo`, `hidemenu` AS `section.hidemenu`, `class_key` AS `section.class_key`, `context_key` AS `section.context_key`, `content_type` AS `section.content_type`, `uri` AS `section.uri`, `uri_override` AS `section.uri_override`, `hide_children_in_tree` AS `section.hide_children_in_tree`, `show_in_tree` AS `section.show_in_tree`, `properties` AS `section.properties`
0.0001731: Added where condition: published=1
0.0000391: Sorted by TicketComment.createdon, DESC
0.0000050: Limited to 10, offset 0
0.0005281: SQL prepared "SELECT SQL_CALC_FOUND_ROWS `TicketComment`.`id`, `TicketComment`.`thread`, `TicketComment`.`parent`, `TicketComment`.`text`, `TicketComment`.`name`, `TicketComment`.`email`, `TicketComment`.`ip`, `TicketComment`.`rating`, `TicketComment`.`rating_plus`, `TicketComment`.`rating_minus`, `TicketComment`.`createdon`, `TicketComment`.`createdby`, `TicketComment`.`editedon`, `TicketComment`.`editedby`, `TicketComment`.`published`, `TicketComment`.`deleted`, `TicketComment`.`deletedon`, `TicketComment`.`deletedby`, `TicketComment`.`properties`, `rating` as `rating_total`, `Thread`.`resource`, `User`.`username`, `Profile`.`internalKey`, `Profile`.`fullname`, `Profile`.`phone`, `Profile`.`mobilephone`, `Profile`.`blocked`, `Profile`.`blockeduntil`, `Profile`.`blockedafter`, `Profile`.`logincount`, `Profile`.`lastlogin`, `Profile`.`thislogin`, `Profile`.`failedlogincount`, `Profile`.`sessionid`, `Profile`.`dob`, `Profile`.`gender`, `Profile`.`address`, `Profile`.`country`, `Profile`.`city`, `Profile`.`state`, `Profile`.`zip`, `Profile`.`fax`, `Profile`.`photo`, `Profile`.`comment`, `Profile`.`website`, `Profile`.`extended`, `Profile`.`email` as `user_email`, `Ticket`.`id` AS `ticket.id`, `Ticket`.`type` AS `ticket.type`, `Ticket`.`contentType` AS `ticket.contentType`, `Ticket`.`pagetitle` AS `ticket.pagetitle`, `Ticket`.`longtitle` AS `ticket.longtitle`, `Ticket`.`description` AS `ticket.description`, `Ticket`.`alias` AS `ticket.alias`, `Ticket`.`link_attributes` AS `ticket.link_attributes`, `Ticket`.`published` AS `ticket.published`, `Ticket`.`pub_date` AS `ticket.pub_date`, `Ticket`.`unpub_date` AS `ticket.unpub_date`, `Ticket`.`parent` AS `ticket.parent`, `Ticket`.`isfolder` AS `ticket.isfolder`, `Ticket`.`introtext` AS `ticket.introtext`, `Ticket`.`richtext` AS `ticket.richtext`, `Ticket`.`template` AS `ticket.template`, `Ticket`.`menuindex` AS `ticket.menuindex`, `Ticket`.`searchable` AS `ticket.searchable`, `Ticket`.`cacheable` AS `ticket.cacheable`, `Ticket`.`createdby` AS `ticket.createdby`, `Ticket`.`createdon` AS `ticket.createdon`, `Ticket`.`editedby` AS `ticket.editedby`, `Ticket`.`editedon` AS `ticket.editedon`, `Ticket`.`deleted` AS `ticket.deleted`, `Ticket`.`deletedon` AS `ticket.deletedon`, `Ticket`.`deletedby` AS `ticket.deletedby`, `Ticket`.`publishedon` AS `ticket.publishedon`, `Ticket`.`publishedby` AS `ticket.publishedby`, `Ticket`.`menutitle` AS `ticket.menutitle`, `Ticket`.`donthit` AS `ticket.donthit`, `Ticket`.`privateweb` AS `ticket.privateweb`, `Ticket`.`privatemgr` AS `ticket.privatemgr`, `Ticket`.`content_dispo` AS `ticket.content_dispo`, `Ticket`.`hidemenu` AS `ticket.hidemenu`, `Ticket`.`class_key` AS `ticket.class_key`, `Ticket`.`context_key` AS `ticket.context_key`, `Ticket`.`content_type` AS `ticket.content_type`, `Ticket`.`uri` AS `ticket.uri`, `Ticket`.`uri_override` AS `ticket.uri_override`, `Ticket`.`hide_children_in_tree` AS `ticket.hide_children_in_tree`, `Ticket`.`show_in_tree` AS `ticket.show_in_tree`, `Ticket`.`properties` AS `ticket.properties`, `Section`.`id` AS `section.id`, `Section`.`type` AS `section.type`, `Section`.`contentType` AS `section.contentType`, `Section`.`pagetitle` AS `section.pagetitle`, `Section`.`longtitle` AS `section.longtitle`, `Section`.`description` AS `section.description`, `Section`.`alias` AS `section.alias`, `Section`.`link_attributes` AS `section.link_attributes`, `Section`.`published` AS `section.published`, `Section`.`pub_date` AS `section.pub_date`, `Section`.`unpub_date` AS `section.unpub_date`, `Section`.`parent` AS `section.parent`, `Section`.`isfolder` AS `section.isfolder`, `Section`.`introtext` AS `section.introtext`, `Section`.`richtext` AS `section.richtext`, `Section`.`template` AS `section.template`, `Section`.`menuindex` AS `section.menuindex`, `Section`.`searchable` AS `section.searchable`, `Section`.`cacheable` AS `section.cacheable`, `Section`.`createdby` AS `section.createdby`, `Section`.`createdon` AS `section.createdon`, `Section`.`editedby` AS `section.editedby`, `Section`.`editedon` AS `section.editedon`, `Section`.`deleted` AS `section.deleted`, `Section`.`deletedon` AS `section.deletedon`, `Section`.`deletedby` AS `section.deletedby`, `Section`.`publishedon` AS `section.publishedon`, `Section`.`publishedby` AS `section.publishedby`, `Section`.`menutitle` AS `section.menutitle`, `Section`.`donthit` AS `section.donthit`, `Section`.`privateweb` AS `section.privateweb`, `Section`.`privatemgr` AS `section.privatemgr`, `Section`.`content_dispo` AS `section.content_dispo`, `Section`.`hidemenu` AS `section.hidemenu`, `Section`.`class_key` AS `section.class_key`, `Section`.`context_key` AS `section.context_key`, `Section`.`content_type` AS `section.content_type`, `Section`.`uri` AS `section.uri`, `Section`.`uri_override` AS `section.uri_override`, `Section`.`hide_children_in_tree` AS `section.hide_children_in_tree`, `Section`.`show_in_tree` AS `section.show_in_tree`, `Section`.`properties` AS `section.properties` FROM `modx_tickets_comments` AS `TicketComment` JOIN `modx_tickets_threads` `Thread` ON `Thread`.`id` = `TicketComment`.`thread` LEFT JOIN `modx_users` `User` ON `User`.`id` = `TicketComment`.`createdby` LEFT JOIN `modx_user_attributes` `Profile` ON `Profile`.`internalKey` = `TicketComment`.`createdby` LEFT JOIN `modx_site_content` `Ticket` ON `Ticket`.`id` = `Thread`.`resource` LEFT JOIN `modx_site_content` `Section` ON `Section`.`id` = `Ticket`.`parent` WHERE `TicketComment`.`published` = 1 GROUP BY TicketComment.id ORDER BY TicketComment.createdon DESC LIMIT 10 "
0.0005331: SQL executed
0.0000920: Total rows: 1
0.0000319: Rows fetched
0.0001271: Returning raw data
0.0084550: Returning processed chunks
0.0139170: Total time
13 107 200: Memory usage
в логе ни «слова» о том что я делал выборку комментариев по thread-у. Странно

UPD2:

Что выяснилось. Во первых выбирать надо было вот так, если по id тикета.
[[!getComments? &resources=`id`]]
Но в случае если комментариев у данного ресурса нет, выводятся все комментарии сайта (WHY???)|

Поэтому решил так это дело:
[[!getComments? &where=`{"Thread.resource":"[[+id]]", "deleted":"0"}`]]
deleted:0 тут нужно потому что если комментарий удален то он все равно выводится дампом? (WHY???) в виде массива php.
kuzmin6969
04 апреля 2015, 09:03
modx.pro
1
2 274
0

Комментарии: 4

Сергей Фещуков
05 апреля 2015, 05:50
0
[[!getComments? &threads=`[[+id]]`]]
Не?
    kuzmin6969
    05 апреля 2015, 08:47
    0
    Я кажется написал что я так и делаю. Все это происходит на странице 'Отзывы', и такой вызов даёт мне под каждым тикетом одинаковый список комментариев. Всех комментариев которые есть на сайте. Хотя id разный в каждом вызове чайка, с этим все ок
      kuzmin6969
      05 апреля 2015, 09:12
      0
      take.ms/ZbQnw
      take.ms/T2pem

      2 тикета, 1 комментарий вообще к удаленному тикету с id 171
      take.ms/xKREE

      и он выводится в обоих случаях хотя вообще не должен
      Konstantin
      23 октября 2015, 11:44
      0
      у меня точно такая же задача использую
      [[!getComments?
      	&resources=`[[+id]]`
      	&limit=`3`
      ]]
      и все прекрасно работает

      строка
      &where=`{"Thread.resource":"[[+id]]", "deleted":"0"}`
      уже не нужна как я понял
        Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.
        4