Get a client by index or alias.

@param string|int $alias
@throws Exception
@return Client
320786
public function client($alias)
    {
        if (is_int($alias) && isset($this->clients[$alias])) {
            return $this->clients[$alias];
        } elseif (isset($this->aliases[$alias])) {
            return $this->aliases[$alias];
        }
        throw new Exception("Client $alias does not exist.");
    }
959902
public function fetch( $alias ) {
		if ( isset( $this->classes[ $alias ] ) ) {
			// If the alias is a class name,
			// then retrieve its linked alias.
			// This is only registered when
			// registering using an array.
			$alias = $this->classes[ $alias ];
		}

		if ( ! isset( $this->aliases[ $alias ] ) ) {
			throw new UndefinedAliasException( $alias );
		}

		$value = $this->definitions[ $alias ];

		// If the shared value is a closure,
		// execute it and assign the result
		// in place of the closure.
		if ( $value instanceof \Closure ) {
			$factory = $value;
			$value   = $factory( $this );
		}

		// If the value is shared, save the shared value.
		if ( isset( $this->shared[ $alias ] ) ) {
			$this->definitions[ $alias ] = $value;
		}

		// Return the fetched value.
		return $value;
	}
898366
public function findOneByAlias($alias)
    {
        $query = $this->createValuedQueryBuilder('c')
            ->where('c.alias = :alias')
            ->setParameter('alias', $alias)
            ->getQuery();

        return $query->useResultCache(true, self::CACHE_TTL)->getSingleResult();
    }
845361
public function getAlias()
    {
        if ($this->_alias === null) {
            throw new Exception('The $alias property can not be null and must be set.');
        }
        
        return $this->item->alias . '/' . $this->_alias;
    }
210992
public static function table($alias = null)
    {
        $className = get_called_class();
        $tableKey = $className . ($alias ? ':' . $alias : '');
        $table = &self::$tables[$tableKey];
        if (null !== $table) {
            return $table;
        }
        /*
        if (isset(self::$settingColumns[$tableKey])) {
            throw new Exception('Already setting columns');
        }
        $columns = new \stdClass();
        self::$settingColumns[$tableKey] = $columns;
        unset(self::$settingColumns[$tableKey]);
        */
        $schemaName = Utils::fromCamelCase(str_replace('\\', '', $className));
        $table = new Table(null, self::getDatabase($className), $schemaName);
        $table->entityClassName = $className;
        $table->alias = $alias;
        static::setUpColumns($table->columns);
        static::setUpTable($table, $table->columns);

        return $table;
    }
1257802
public function get($alias)
    {
        if (!array_key_exists($alias, $this->adapters)) {
            throw new \InvalidArgumentException(sprintf('There is no adapter registered under that alias: "%s"', $alias));
        }

        return $this->adapters[$alias];
    }
775241
protected function aliasToMatcher($alias)
    {
        foreach ($this->matchers as $class => $aliases) {
            if (in_array($alias, $aliases)) {
                return $class;
            }
        }

        throw new Exceptions\UnknownAliasException($alias);
    }
748932
public function get($alias)
    {
        if ( ! $this->has($alias)) {
            throw new UnexpectedValueException(sprintf(
                'Could not locate filter %s in',
                $alias
            ));
        }
        if ($alias instanceof EntityFilterInterface) {
            $alias = $alias->getName();
        }
        return $this->filters[$alias];
    }
822057
public function getClassFromAlias($alias)
        {
            if (!isset($this->aliases[$alias])) {
                return false;
            }

            $r = 0;

            while (isset($this->aliases[$alias])) {
                $alias = $this->aliases[$alias];
                $r++;

                if ($r > 100) {
                    throw new Exception(
                        sprintf('Possible infinite recursion in DI alias! Max recursion of 100 levels reached at alias "%s".', $alias)
                    );
                }
            }

            return $alias;
        }
1115161
public static function retrieve($alias)
    {
        if (!isset(static::$instances[$alias])) {
            static::$instances[$alias] = static::addPlugins(new Filesystem(static::create($alias)));
        }

        return static::$instances[$alias];
    }
110103
public function getProvider($alias)
    {
        if (array_key_exists($alias, $this->providers)) {
            return $this->providers[$alias];
        }

        return null;
    }
1211500
public function getFilter($index)
    {
        if (!$this->hasFilter($index)) {
            throw new \Exception('Impossible de trouver le filtre : ' . $index);
        }

        return $this->filters[$index];
    }
776065
public function alias($alias)
    {
        $alias = (string)$alias;
        if (in_array($alias, $this->with)) {
            throw new \InvalidArgumentException("Cannot use alias '{$alias}' because a relation already uses it");
        }

        $this->alias = $alias;

        return $this;
    }
423610
public function get($alias)
    {
        $alias = $this->normalizeNamespace($alias);

        if (isset($this->byAlias[$alias])) {
            return $this->byAlias[$alias];
        }

        if (isset($this->byEntity[$alias])) {
            return $this->byEntity[$alias];
        }

        throw new ModelException(sprintf('Model for entity "%s" does not exists', $alias));
    }
755537
public function setAlias($alias)
    {
        if (!is_string($alias)) {
            throw new Exception(Exception::CODE_PARAM_VALUE_ERROR_MSG . ' Alias Must A String', Exception::CODE_PARAM_VALUE_ERROR);
        }
        $lastPattern = array_pop($this->_patterns);
        if ($lastPattern) {
            $lastPattern[5] = $alias;
            $this->_patterns[] = $lastPattern;
        }
        return $this;
    }
1075100
public static function getRouteByAlias($alias)
    {
        //No routes
        if (empty(self::$routes)) {
            return;
        }

        //Search in the map
        $route = null;

        if (($index = array_search($alias, array_column(self::$routes, 'alias'))) !== false) {
            $route = self::$routes[$index]['route'];
        }

        return $route;
    }
426295
public static function getByAlias($alias) 
    {
		$f = self::getDbConnection()->fetchAssoc('SELECT * FROM menus WHERE alias=?',array($alias));
		if (!$f) throw new Exception\CMS('Меню alias='.$alias.' не найдено');
		return new self($f);
  	}