I have built a quoting/invoicing system using the builder plugin in OctoberCMS and I have ran into a speedbump. I am trying to save an array to the database to be used as list items for the invoice but when I try to view the invoice in the backend I get the following Exception:
htmlentities() expects parameter 1 to be string, array given
I have written this as a component and the section which is causing the issue looks like this:
public function items() {
$plates = Db::table('orders')->where('quote_no', $this->quoteNo())->value('total_plate_qty');
$hires = Db::table('orders')->where('quote_no', $this->quoteNo())->value('req_hires');
$hardcopy = Db::table('orders')->where('quote_no', $this->quoteNo())->value('req_hardcopy_proof');
$pdfproof = Db::table('orders')->where('quote_no', $this->quoteNo())->value('req_pdf_proof');
if ($plates != 0) {
$plates = "Total Plates: " . $plates;
} else {
$plates = "None";
}
if ($pdfproof === 'yes') {
$pdfproof = 'PDF Proof @ R25.00';
} else {
$hires = 'None';
}
if ($hires === 'yes') {
$hires = 'HiRes PDF @ R50.00';
} else {
$hires = 'None';
}
if ($hardcopy === 'yes') {
$hardcopy = 'HardCopy Proof @ R150.00';
} else {
$hardcopy = 'None';
}
return [
'plates' => $plates,
'pdf' => $pdfproof,
'hires' => $hires,
'hardcopy' => $hardcopy
];
}
In the database the column in question is type TEXT and my model type in Builder for this field is also TEXT.
I am guessing that the issue is in the view of my model but I am unsure how to correct this, any help will be greatly appreciated.