[EDIT] Fixing empty result from answerzipper
Data returned from these lines of code
$submission = new Submission();
$submission->has("answer_slot", ["deleted_on = ?", null]);
$submission->has("participant.exam", ["id=?", $exam->_id]);
$submissions = $submission->find();
is an object and somehow not counted as an associative array.
When the code reaches this line:
if (!is_array($submissions)) {
$submissions = [];
}
submission is being set to an empty array because the statement !is_array($submissions)
is fulfilled.
By changing !is_array($submissions)
to !is_iterable($submissions)
, the $submission
won't be set to an empty array because the object/associate array is iterable.
Edited by Christian SGPN