pdoResources - Unknown column 'TVMyTV.value'

Вот вызов сниппета
$w = array();
$tsex = array();
if ($_GET['boys'] == 1) {
    $tsex[] = 2;
}
if ($_GET['girls'] == 1) {
    $tsex[] = 1;
}
$w[] = array('TVSex.value:IN' => $tsex);
$fix = $_GET['max_age'] + 1;
$fix2 = $_GET['min_age'];
$w[] = array(
    'TVBirthday.value:>=' => date('Y-m-d', strtotime("-$fix year")),
    'AND:TVBirthday.value:<=' => date('Y-m-d', strtotime("-$fix2 year"))
);
$modx->log(modX::LOG_LEVEL_ERROR, json_encode(array_values($w)));
return $modx->runSnippet('pdoResources', array(
            'depth' => 2,
            'parents' => $GET['city'],
            'limit' => 30,
            'tpl' => 'GalleryPreview',
            'includeTVs' => 'Sex, Name, Birthday, Birthday2, image, Video',
            'includeContent' => 1,
            'prepareTVs' => 1,
            'sortby' => 'menuindex',
            'offset' => $_GET['offset'],
            'where' => json_encode(array_values($w)),
            'hideContainers' => 1,
            'showLog'=>1
                )
);
&where получается
[{«TVSex.value:IN»:[2,1]},{«TVBirthday.value:>=»:«1998-06-07»,«AND:TVBirthday.value:<=»:«2017-06-07»}]
А вот лог
0.0002201: pdoTools loaded
0.0000429: xPDO query object created
0.0006680: Included list of tvs: Name, Birthday, Image, Sex, Video, Birthday2
0.0003679: leftJoined modTemplateVarResource as TVname
0.0002871: leftJoined modTemplateVarResource as TVbirthday
0.0002918: leftJoined modTemplateVarResource as TVimage
0.0002840: leftJoined modTemplateVarResource as TVsex
0.0002921: leftJoined modTemplateVarResource as TVvideo
0.0002871: leftJoined modTemplateVarResource as TVbirthday2
0.0006649: Added selection of modResource: SQL_CALC_FOUND_ROWS `id`, `type`, `contentType`, `pagetitle`, `longtitle`, `description`, `alias`, `link_attributes`, `published`, `pub_date`, `unpub_date`, `parent`, `isfolder`, `introtext`, `content`, `richtext`, `template`, `menuindex`, `searchable`, `cacheable`, `createdby`, `createdon`, `editedby`, `editedon`, `deleted`, `deletedon`, `deletedby`, `publishedon`, `publishedby`, `menutitle`, `donthit`, `privateweb`, `privatemgr`, `content_dispo`, `hidemenu`, `class_key`, `context_key`, `content_type`, `uri`, `uri_override`, `hide_children_in_tree`, `show_in_tree`, `properties`
0.0000162: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.Name`
0.0000112: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.Birthday`
0.0000100: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.Image`
0.0000100: Added selection of modTemplateVarResource: IFNULL(`value`, '0') AS `tv.Sex`
0.0000100: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.Video`
0.0000110: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.Birthday2`
0.0000591: Replaced TV conditions
0.0000932: Replaced TV conditions
0.0003238: Replaced TV conditions
0.0000939: Processed additional conditions
0.0016520: Added where condition: TVSex.value:IN(2,1), TVBirthday.value:>==1998-06-07, AND:TVBirthday.value:<==2017-06-07, modResource.published=1, modResource.deleted=0, modResource.isfolder=0
0.0000579: Replaced TV conditions
0.0002470: Sorted by modResource.menuindex, DESC
0.0000060: Limited to 30, offset 30
0.0007651: SQL prepared «SELECT SQL_CALC_FOUND_ROWS `modResource`.`id`, `modResource`.`type`, `modResource`.`contentType`, `modResource`.`pagetitle`, `modResource`.`longtitle`, `modResource`.`description`, `modResource`.`alias`, `modResource`.`link_attributes`, `modResource`.`published`, `modResource`.`pub_date`, `modResource`.`unpub_date`, `modResource`.`parent`, `modResource`.`isfolder`, `modResource`.`introtext`, `modResource`.`content`, `modResource`.`richtext`, `modResource`.`template`, `modResource`.`menuindex`, `modResource`.`searchable`, `modResource`.`cacheable`, `modResource`.`createdby`, `modResource`.`createdon`, `modResource`.`editedby`, `modResource`.`editedon`, `modResource`.`deleted`, `modResource`.`deletedon`, `modResource`.`deletedby`, `modResource`.`publishedon`, `modResource`.`publishedby`, `modResource`.`menutitle`, `modResource`.`donthit`, `modResource`.`privateweb`, `modResource`.`privatemgr`, `modResource`.`content_dispo`, `modResource`.`hidemenu`, `modResource`.`class_key`, `modResource`.`context_key`, `modResource`.`content_type`, `modResource`.`uri`, `modResource`.`uri_override`, `modResource`.`hide_children_in_tree`, `modResource`.`show_in_tree`, `modResource`.`properties`, IFNULL(`TVname`.`value`, '') AS `tv.Name`, IFNULL(`TVbirthday`.`value`, '') AS `tv.Birthday`, IFNULL(`TVimage`.`value`, '') AS `tv.Image`, IFNULL(`TVsex`.`value`, '0') AS `tv.Sex`, IFNULL(`TVvideo`.`value`, '') AS `tv.Video`, IFNULL(`TVbirthday2`.`value`, '') AS `tv.Birthday2` FROM `modx_site_content` AS `modResource` LEFT JOIN `modx_site_tmplvar_contentvalues` `TVname` ON `TVname`.`contentid` = `modResource`.`id` AND `TVname`.`tmplvarid` = 4 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVbirthday` ON `TVbirthday`.`contentid` = `modResource`.`id` AND `TVbirthday`.`tmplvarid` = 5 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVimage` ON `TVimage`.`contentid` = `modResource`.`id` AND `TVimage`.`tmplvarid` = 6 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVsex` ON `TVsex`.`contentid` = `modResource`.`id` AND `TVsex`.`tmplvarid` = 9 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVvideo` ON `TVvideo`.`contentid` = `modResource`.`id` AND `TVvideo`.`tmplvarid` = 10 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVbirthday2` ON `TVbirthday2`.`contentid` = `modResource`.`id` AND `TVbirthday2`.`tmplvarid` = 11 WHERE ( `TVSex`.`value` IN ('2','1') AND ( `TVBirthday`.`value` >= '1998-06-07' AND `TVBirthday`.`value` <= '2017-06-07' ) AND `modResource`.`published` = 1 AND `modResource`.`deleted` = 0 AND `modResource`.`isfolder` = 0 ) ORDER BY modResource.menuindex DESC LIMIT 30, 30 „
0.0012381: Could not process query, error #1054: Unknown column 'TVSex.value' in 'where clause'
0.0076551: Total time
4 718 592: Memory usage
Кто что скажет?)
r3l0c
06 июня 2017, 22:55
modx.pro
999
0

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

Андрей
07 июня 2017, 06:42
+1
У вас в логе написано же leftJoined modTemplateVarResource as TVsex, а в where TVSex.
    r3l0c
    07 июня 2017, 12:33
    0
    Ну я видел)
    r3l0c
    08 июня 2017, 06:38
    0
    Короч решил проблему, просто переименовал все TV в нижний регистр =). Надеюсь великий сенсей пофиксит этот баг))
      Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.
      3