pixie icon indicating copy to clipboard operation
pixie copied to clipboard

Fixed notices in QueryBuilderHandler

Open skipperbent opened this issue 9 years ago • 2 comments

Fixed notices in QueryBuilderHandler class when $row[0] is not set.

skipperbent avatar May 21 '16 03:05 skipperbent

May it be possible for you to add a unit-test to show the bug / fix? This will make the source of Pixie more secure.

eL-Prova avatar May 21 '16 07:05 eL-Prova

I think the fix is a bit small to create unit-testing for.

If you want to reproduce the error yourself, it seems like there's it occurs when calling count() after having used groupBy.

This is my query if you want to investigate any further yourself.

$messages->whereNotNull('customer_id')->orderBy('created_date', 'DESC');

$updateQuery = $messages;

$messages = Message::table($messages->subQuery($messages, 'messages'));
$messages->orderBy('read');
$messages->orderBy('created_date', 'DESC');
$messages->groupBy('event_id');

$this->maxPages = ceil($messages->count() / $this->limit);
$this->page = input()->get('page', 0);

$messages->offset($this->page * $this->limit);
$messages->limit($this->limit);

$this->messages = $messages->all();

// Set messages as read
$updateQuery->update(['read' => 1]);

Removing groupBy removes the notice - which is triggered by calling the count() method.

bookandbegin_dashboard

skipperbent avatar May 21 '16 16:05 skipperbent