public function setObject($mode, $objectKey, $constraintType, $constraintCode, $withSub = false, $targetType, $targetId, $access, $fields = null)
{
$objectKey = Objects::normalizeObjectKey($objectKey);
$acl = new AclObject();
$acl->setMode($mode);
$acl->setTargetType($targetType);
$acl->setTargetId($targetId);
$acl->setSub($withSub);
$acl->setAccess($access);
if ($fields) {
$acl->setFields(json_encode($fields));
}
$acl->setObject($objectKey);
$acl->setConstraintCode(is_array($constraintCode) ? json_encode($constraintCode) : $constraintCode);
$acl->setConstraintType($constraintType);
$query = new \Jarves\Model\AclQuery();
$query->select('Prio');
$query->filterByObject($objectKey);
$query->filterByMode($mode);
$query->orderByPrio(Criteria::DESC);
$highestPrio = (int) $query->findOne();
$acl->setPrio($highestPrio + 1);
$this->cache[$objectKey . '_' . $mode] = null;
$acl->save();
return $acl;
}