Skip to content

Instantly share code, notes, and snippets.

@FroggyWeb
Last active January 12, 2018 07:26
Show Gist options
  • Select an option

  • Save FroggyWeb/3cad75de7d3aaebb8fa796cceec57782 to your computer and use it in GitHub Desktop.

Select an option

Save FroggyWeb/3cad75de7d3aaebb8fa796cceec57782 to your computer and use it in GitHub Desktop.
where запросы проверка через консоль и группировка
Собственно все можете проверять в консоли modx.
$where = array(
array(
"available:="=>"0"
,"AND:toOrder:="=>"1"
)
,"OR:available:="=>"1"
);
$c = $modx->newQuery('modResource');
$c->where($where);
$c->select('id');
$c->prepare()
echo $c->toSQL();
Вернет:
SELECT `id` FROM `modx_site_content` AS `modResource` WHERE ( ( `modResource`.`available` = '0' AND `modResource`.`toOrder` = '1' ) OR `modResource`.`available` = '1' )
А если сделать вот так:
echo $modx->toJSON($where);
получите вашу JSON строку:
{"0":{"available:=":"0","AND:toOrder:=":"1"},"OR:available:=":"1"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment