RawLayout.php
public function addAlias($alias, $id)
    {
        $this->validateAlias($alias, true);
        $this->validateId($id, true);
        // perform additional validations
        if ($alias === $id) {
            throw new Exception\LogicException(
                sprintf(
                    'The "%s" sting cannot be used as an alias for "%s" item'
                    . ' because an alias cannot be equal to the item id.',
                    $alias,
                    $id
                )
            );
        }
        if (isset($this->items[$alias])) {
            throw new Exception\LogicException(
                sprintf(
                    'The "%s" sting cannot be used as an alias for "%s" item'
                    . ' because another item with the same id exists.',
                    $alias,
                    $id
                )
            );
        }
        if (!isset($this->items[$this->resolveId($id)])) {
            throw new Exception\ItemNotFoundException(sprintf('The "%s" item does not exist.', $id));
        }

        $this->aliases->add($alias, $id);
    }
public function addAlias($alias, $id)
    {
        $this->validateAlias($alias, true);
        $this->validateId($id, true);
        // perform additional validations
        if ($alias === $id) {
            throw new Exception\LogicException(
                sprintf(
                    'The "%s" sting cannot be used as an alias for "%s" item'
                    . ' because an alias cannot be equal to the item id.',
                    $alias,
                    $id
                )
            );
        }
        if (isset($this->items[$alias])) {
            throw new Exception\LogicException(
                sprintf(
                    'The "%s" sting cannot be used as an alias for "%s" item'
                    . ' because another item with the same id exists.',
                    $alias,
                    $id
                )
            );
        }
        if (!isset($this->items[$this->resolveId($id)])) {
            throw new Exception\ItemNotFoundException(sprintf('The "%s" item does not exist.', $id));
        }

        $this->aliases->add($alias, $id);
    }
public function addAlias ( $ alias , $ id ) { $ this -> validateAlias ( $ alias , true ) ; $ this -> validateId ( $ id , true ) ; // perform additional validations if ( $ alias === $ id ) { throw new Exception \ LogicException ( sprintf ( 'The "%s" sting cannot be used as an alias for "%s" item' . ' because an alias cannot be equal to the item id.' , $ alias , $ id ) ) ; } if ( isset ( $ this -> items [ $ alias ] ) ) { throw new Exception \ LogicException ( sprintf ( 'The "%s" sting cannot be used as an alias for "%s" item' . ' because another item with the same id exists.' , $ alias , $ id ) ) ; } if ( ! isset ( $ this -> items [ $ this -> resolveId ( $ id ) ] ) ) { throw new Exception \ ItemNotFoundException ( sprintf ( 'The "%s" item does not exist.' , $ id ) ) ; } $ this -> aliases -> add ( $ alias , $ id ) ; }
Creates an alias for the specified layout item

@param string $alias A string that can be used to access to the layout item instead of its id
@param string $id    The layout item id

@throws Exception\InvalidArgumentException if the alias or id are empty or invalid
@throws Exception\ItemNotFoundException if the layout item with the given id does not exist
@throws Exception\AliasAlreadyExistsException if the alias is used for another layout item
@throws Exception\LogicException if the alias cannot be added by other reasons
Creates an alias for the specified layout item