<?php

class PolylangPolylangSeoPatternRemoveProcessor extends modObjectRemoveProcessor
{
    public $classKey = 'PolylangSeoPattern';
    public $languageTopics = array('polylang:default');
    public $permission = 'polylang_polylangseopattern_remove';
    /** @var Polylang $polylang  */
    public $polylang;

    public function initialize()
    {
        if (!$this->modx->hasPermission($this->permission)) {
            return $this->modx->lexicon('access_denied');
        }
        // $this->polylang = $this->modx->getService('polylang', 'Polylang');
        return parent::initialize();
    }

    public function afterRemove()
    {

        $table = $this->modx->getTableName($this->classKey);
        $rank = $this->object->get('rank');
        $parent = $this->object->get('parent_id');
        /*$sql = "UPDATE {$table} SET `rank`=`rank`-1 WHERE `rank`>{$rank}
        // AND  `parent_id` = {$parent)
        ";
        $this->modx->exec($sql);*/

        return parent::afterRemove();
    }

}
return 'PolylangPolylangSeoPatternRemoveProcessor';