Scalr\Api\Service\User\V1beta0\Controller\CostCenters::getDefaultCriteria PHP Method

getDefaultCriteria() public method

Gets default search criteria
public getDefaultCriteria ( ) : array
return array Returns array of the search criteria
    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();
        }
    }