In most cases, XenForo's entity system treats a string as if it was an array with 1 entry. But the primaryKey appears somewhat special.
This will cause unexpected errors when you pass an integer to whereId or whereIds function;
$structure->primaryKey = 'monitor_id';
$structure->primaryKey = ['monitor_id'];
ErrorException: [E_WARNING] array_key_exists() expects parameter 2 to be array, integer given in src/XF/Mvc/Entity/Finder.php at line 433