public function getItem($pk, $fields = null, $withAcl = false)
{
$storageController = $this->objects->getStorageController($this->getObject());
$pk = $storageController->normalizePrimaryKey($pk);
$this->primaryKey = $pk;
$aclRequest = ACLRequest::create($this->getObject(), $pk)->onlyViewMode();
if ($this->getPermissionCheck() && !$this->acl->check($aclRequest)) {
return null;
}
$options['fields'] = $this->getItemSelection($fields);
$item = $storageController->getItem($pk, $options);
//check against additionally our own custom condition
if ($item && ($condition = $this->getCondition()) && $condition->hasRules()) {
if (!$this->conditionOperator->satisfy($condition, $item, $this->getObject())) {
$item = null;
}
}
if ($limitDataSets = $this->getObjectDefinition()->getLimitDataSets()) {
if (!$this->conditionOperator->satisfy($limitDataSets, $item, $this->getObject())) {
return null;
}
}
if ($item && $withAcl) {
$this->prepareRow($item);
$this->prepareFieldAcl($item);
}
return $item;
}