applyRulesFromPk() public method

public applyRulesFromPk ( Condition $condition, array $pk, string $objectKey )
$condition Jarves\Configuration\Condition
$pk array
$objectKey string
Exemplo n.º 1
0
 /**
  * @param Condition|array $filter
  * @param string $query
  * @return int
  */
 public function getCount($filter, $query = '')
 {
     $storageController = $this->objects->getStorageController($this->getObject());
     $condition = new Condition(null, $this->jarves);
     if ($filter && is_array($filter)) {
         $this->conditionOperator->applyRulesFromPk($condition, $filter, $this->getObject());
     } else {
         if ($filter instanceof Condition) {
             $condition = $filter;
         } else {
             $condition = new Condition(null, $this->jarves);
         }
     }
     if ($limit = $this->getObjectDefinition()->getLimitDataSets()) {
         $condition->mergeAnd($limit);
     }
     if ($this->getPermissionCheck() && ($aclCondition = $this->acl->getListingCondition($this->getObject()))) {
         $condition->mergeAndBegin($aclCondition);
     }
     if ($query) {
         if ($queryCondition = $this->getQueryCondition($query, $this->getItemsSelection())) {
             $condition->mergeAnd($queryCondition);
         }
     }
     return $storageController->getCount($condition);
 }