Last active
January 12, 2018 07:26
-
-
Save FroggyWeb/3cad75de7d3aaebb8fa796cceec57782 to your computer and use it in GitHub Desktop.
where запросы проверка через консоль и группировка
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Собственно все можете проверять в консоли 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