OK, I have a view template where I want to display an associated value from my 'item' entity:
<?= h($item->itemgroup->groupname)?>
If the $item->itemgroup_id is NULL, I get the error:
Trying to get property of non-object
It also errors without the h() function. However, if I change the view code to:
<?= h($item['itemgroup']['groupname']) ?>
It does not error, and displays a blank as expected.
Is it necessary to update all the baked view template code where a value is potentially NULL? Or is it a matter of database setup (i.e., not using NULL for a field that can be potentially blank)?
Thanks in advance for any insight or advice?
Cheers, D.