Scalr\Model\Entity\Account\User::getEnvironments PHP Метод

getEnvironments() публичный Метод

Gets environments of the current user filtered by name
public getEnvironments ( string $filter = null ) : array
$filter string optional Filter string
Результат array
    public function getEnvironments($filter = null)
    {
        $like = '';
        if (isset($filter)) {
            $like = " AND ce.name LIKE '%" . $this->db()->escape($filter) . "%'";
        }
        if ($this->canManageAcl()) {
            return $this->db()->getAll('SELECT ce.id, ce.name FROM client_environments ce WHERE ce.client_id = ?' . $like, array($this->getAccountId()));
        } else {
            $teams = array();
            foreach ($this->getTeams() as $team) {
                $teams[] = $team['id'];
            }
            if (count($teams)) {
                return $this->db()->getAll('
                    SELECT ce.id, ce.name FROM client_environments ce
                    JOIN account_team_envs te ON ce.id = te.env_id
                    WHERE te.team_id IN (' . implode(',', $teams) . ')' . $like . '
                    GROUP BY ce.id
                ');
            }
        }
        return array();
    }