nrep
Well-known member
I'm coding an XF2 addon that will fetch a list of the last 10 resources entries, but also allow me to access the message content of each (so I can provide a teaser snippet). I've got the code to get the last 10 XFRM entries, but I'm struggling on how to add to the array to provide me with the message content. Here's my code so far:
However, when I try it, this is the error I get:
How should I add to the array so that I can add the message variable?
PHP:
$reviews = \XF::finder('XFRM:ResourceItem')->order('last_update', 'DESC')->fetch(max(0, 10));
foreach ($reviews AS $id => $review)
{
$resourcemessage = $db->fetchOne("
SELECT message
FROM xf_rm_resource_update
WHERE resource_id = ?
ORDER BY resource_update_id DESC
", $review->resource_id);
$reviews[$id]['message'] = $resourcemessage;
}
However, when I try it, this is the error I get:
InvalidArgumentException: Column 'message' is unknown in src\XF\Mvc\Entity\Entity.php at line 582
How should I add to the array so that I can add the message variable?