Skip to content

Commit

Permalink
Support empty query
Browse files Browse the repository at this point in the history
Parse pusher supports pushing to all installations at once using "where" : "{}", however with php sdk it's not possible, if you don't pass a where query it will throw "'Missing the push channels.", if an empty ParseQuery is used, "undefined index where" is thrown. This patch aim to pass a "{}" if an empty parse query object is passed.
  • Loading branch information
sahanh committed Oct 13, 2015
1 parent 534c693 commit 8e7d135
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Parse/ParsePush.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,15 @@ public static function send($data, $useMasterKey = false)
}
if (isset($data['where'])) {
if ($data['where'] instanceof ParseQuery) {
$data['where'] = $data['where']->_getOptions()['where'];

$where_options = $data['where']->_getOptions();

if (!isset($query_where['where'])) {
$data['where'] = '{}';
} else {
$data['where'] = $data['where']->_getOptions()['where'];
}

} else {
throw new Exception(
'Where parameter for Parse Push must be of type ParseQuery'
Expand Down

2 comments on commit 8e7d135

@stoiev
Copy link
Contributor

@stoiev stoiev commented on 8e7d135 Oct 26, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! It seens there is a typo here, $query_where is not defined. It results that 'where' option to ParsePush::send is ignored. Related to #167

@gfosco
Copy link
Contributor

@gfosco gfosco commented on 8e7d135 Oct 26, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh... good catch.. Can you send in a PR to fix that to be $where_options instead of $query_where?

Please sign in to comment.