I just ran into the strangest thing: when adding the multipleSize parameter to the selector_category plugin and trying to store multiple values for a category, these selections are not being stored. Tracking down this behaviour I found the following in ObjectUtil storeObjectCategories:
Code
foreach ($obj['__CATEGORIES__'] as $prop => $cat)
{
// if there's all the data and the Registry exists
// the category is mapped
if ($cat && $prop && isset($reg_ids[$prop]))
{
$cobj['id'] = '';
$cobj['modname'] = $modname;
$cobj['obj_id'] = $obj[$idcolumn];
$cobj['category_id'] = $cat;
$cobj['reg_id'] = $reg_ids[$prop];
$res = DBUtil::insertObject ($cobj, 'categories_mapobj');
}
}
{
// if there's all the data and the Registry exists
// the category is mapped
if ($cat && $prop && isset($reg_ids[$prop]))
{
$cobj['id'] = '';
$cobj['modname'] = $modname;
$cobj['obj_id'] = $obj[$idcolumn];
$cobj['category_id'] = $cat;
$cobj['reg_id'] = $reg_ids[$prop];
$res = DBUtil::insertObject ($cobj, 'categories_mapobj');
}
}
For a multiple selection $cat is an array, therefore the if condition fails, therefore InsertObject is never called.
Am I talking total crap? Is this a bug (I can't believe nobody else ran into this problem before)?
edited by: dits, datetimebrief
