Beispiel #1
0
 /**
  * Gets default search criteria
  *
  * @return array Returns array of the search criteria
  *
  * @throws ApiNotImplementedErrorException
  */
 public function getDefaultCriteria()
 {
     switch ($this->getScope()) {
         case ScopeInterface::SCOPE_ENVIRONMENT:
             return [['$and' => [['ccId' => $this->getEnvironmentCostCenterId()]]]];
         case ScopeInterface::SCOPE_ACCOUNT:
             $cc = new CostCentreEntity();
             $accs = new AccountCostCenterEntity();
             return [AbstractEntity::STMT_FROM => "{$cc->table()} LEFT JOIN {$accs->table()} AS `accs` ON {$accs->columnCcId('accs')} = {$cc->columnCcId()}", AbstractEntity::STMT_WHERE => "{$accs->columnAccountId('accs')} = " . $accs->qstr('accountId', $this->getUser()->accountId)];
         case ScopeInterface::SCOPE_SCALR:
             throw new ApiNotImplementedErrorException();
     }
 }