Hello. I have a code that works ok with php 5.6 and Phalcon 2.0.x and php 5.6 and Phalcon 3, however when I have moved to php 7.0.11 and Phalcon 3.0.1 I started to get the error:
Fatal error: Uncaught Phalcon\Mvc\Model\Exception: Column 'id' is not part of the column map in /myapp/apps/rest/controllers/ItemsController.php on line 32
A piece of code looks like this:
$invoice = Models\Invoice::findFirst($cartId);
$items = $invoice -> getInvoiceItems([
'conditions'=>'part_number LIKE :part_n: AND part_description LIKE :part_descr: AND product_group LIKE :group:',
'bind' => [
'part_n' => $getPartNum,
'part_descr' => $getPartDescription,
'group' => $getPartGrp
],
'order' => 'part_index'
]);
//this gives me error
$data = $items -> toArray();
If I dump $items ResultSet before toArray() I see:
protected '_columnMap' =>
array (size=14)
'id' =>
array (size=2)
0 => string 'id' (length=2)
1 => int 0
'invoice_id' =>
array (size=2)
0 => string 'invoice_id' (length=10)
1 => int 0
// and so on...
As I understand it, this means that column id is actually in the column map ( and why it's important to have it anyway to convert to array?). What might cause this error then?