protected function generateListAlias($entity)
    {
        if (!$this->alias->isSupportedEntity($entity)) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        $model = gplcart_instance_model($entity);

        if (!$model instanceof CrudInterface) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        ini_set('memory_limit', '-1');

        $added = $count = 0;

        foreach ($model->getList() as $item) {

            if (empty($item["{$entity}_id"])) {
                continue;
            }

            $count++;
            $entity_id = $item["{$entity}_id"];

            $this->alias->delete(array('entity' => $entity, 'entity_id' => $entity_id));

            $data = array(
                'entity' => $entity,
                'entity_id' => $entity_id,
                'alias' => $this->alias->generateEntity($entity, $item)
            );

            if ($this->alias->add($data)) {
                $added++;
            }
        }

        return $count && $count == $added;
    }
protected function generateListAlias($entity)
    {
        if (!$this->alias->isSupportedEntity($entity)) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        $model = gplcart_instance_model($entity);

        if (!$model instanceof CrudInterface) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        ini_set('memory_limit', '-1');

        $added = $count = 0;

        foreach ($model->getList() as $item) {

            if (empty($item["{$entity}_id"])) {
                continue;
            }

            $count++;
            $entity_id = $item["{$entity}_id"];

            $this->alias->delete(array('entity' => $entity, 'entity_id' => $entity_id));

            $data = array(
                'entity' => $entity,
                'entity_id' => $entity_id,
                'alias' => $this->alias->generateEntity($entity, $item)
            );

            if ($this->alias->add($data)) {
                $added++;
            }
        }

        return $count && $count == $added;
    }
protected function generateListAlias ( $ entity ) { if ( ! $ this -> alias -> isSupportedEntity ( $ entity ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ model = gplcart_instance_model ( $ entity ) ; if ( ! $ model instanceof CrudInterface ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } ini_set ( 'memory_limit' , '-1' ) ; $ added = $ count = 0 ; foreach ( $ model -> getList ( ) as $ item ) { if ( empty ( $ item [ "{$entity}_id" ] ) ) { continue ; } $ count ++ ; $ entity_id = $ item [ "{$entity}_id" ] ; $ this -> alias -> delete ( array ( 'entity' => $ entity , 'entity_id' => $ entity_id ) ) ; $ data = array ( 'entity' => $ entity , 'entity_id' => $ entity_id , 'alias' => $ this -> alias -> generateEntity ( $ entity , $ item ) ) ; if ( $ this -> alias -> add ( $ data ) ) { $ added ++ ; } } return $ count && $ count == $ added ; }
Mass generate URL aliases for the given entity
@param string $entity
@return bool
Mass generate URL aliases for the given entity