public function cmdAddAlias()
    {
        $params = $this->getParam();

        if (count($params) != 3) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        list($entity, $entity_id, $alias) = $params;

        if (empty($entity) || empty($entity_id) || empty($alias) || !is_numeric($entity_id)) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        if (!$this->alias->loadEntity($entity, $entity_id)) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        $result = $this->addAlias($entity, $entity_id, $alias);

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        $this->line($result);
        $this->output();
    }
public function cmdAddAlias()
    {
        $params = $this->getParam();

        if (count($params) != 3) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        list($entity, $entity_id, $alias) = $params;

        if (empty($entity) || empty($entity_id) || empty($alias) || !is_numeric($entity_id)) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        if (!$this->alias->loadEntity($entity, $entity_id)) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        $result = $this->addAlias($entity, $entity_id, $alias);

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        $this->line($result);
        $this->output();
    }
public function cmdAddAlias ( ) { $ params = $ this -> getParam ( ) ; if ( count ( $ params ) != 3 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } list ( $ entity , $ entity_id , $ alias ) = $ params ; if ( empty ( $ entity ) || empty ( $ entity_id ) || empty ( $ alias ) || ! is_numeric ( $ entity_id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } if ( ! $ this -> alias -> loadEntity ( $ entity , $ entity_id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ result = $ this -> addAlias ( $ entity , $ entity_id , $ alias ) ; if ( empty ( $ result ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> line ( $ result ) ; $ this -> output ( ) ; }
Callback for "alias-add" command
Callback for alias - add command