I try to iterate over array dishsizes.
Debug of line 153 is:
‘unitprice’ => ‘5’,
‘ingredient_id’ => ‘1’,
‘currency_id’ => ‘1’,
‘dishsize_id’ => ‘1’,
When I try to get the ingredient_id with $ingredient_id = intval($dishsize['ingredient_id']);
it results in
(int) 1
(result of debug in line 155)
when I run this query:
$query=$this->Ingredients->Dishsizesingredients->find('all',[ 'conditions'=>['Dishsizesingredients.ingredient_id'=>$ingredient_id], ]);
it deletes all existing entries with ingredient_id=1
If I hardcode the ingredient_id with $ingredient_id=60;
the query runs with no problems.
Could this be, because ingredient_id
in my database is bigint
, and if that is the reason, how can I get this running?
Here is the whole code, that im struggling with
foreach($dishsizes AS $dishsize) {
debug($dishsize); //line 153
$ingredient_id = intval($dishsize['ingredient_id']);
debug($ingredient_id); //line 155
//die();
$ingredient_id=60; //line 158
debug($ingredient_id);
//die();
$query=$this->Ingredients->Dishsizesingredients->find('all',[
'conditions'=>['Dishsizesingredients.ingredient_id'=>$ingredient_id],
]);
$result=$query->toArray();
debug($result);
die();
}