public function beforeDelete(Event $event, Entity $entity)
    {
        $orderField = $this->_config['order'];
        list($order, $scope) = $this->_getOldValues($entity);

        $this->_sync(
            [$orderField => $this->_getUpdateExpression('-')],
            [$orderField . ' >' => $order],
            $scope
        );
    }
public function beforeDelete(Event $event, Entity $entity)
    {
        $orderField = $this->_config['order'];
        list($order, $scope) = $this->_getOldValues($entity);

        $this->_sync(
            [$orderField => $this->_getUpdateExpression('-')],
            [$orderField . ' >' => $order],
            $scope
        );
    }
public function beforeDelete ( Event $ event , Entity $ entity ) { $ orderField = $ this -> _config [ 'order' ] ; list ( $ order , $ scope ) = $ this -> _getOldValues ( $ entity ) ; $ this -> _sync ( [ $ orderField => $ this -> _getUpdateExpression ( '-' ) ] , [ $ orderField . ' >' => $ order ] , $ scope ) ; }
When you delete a record from a set, you need to decrement the order of all
records that were after it in the set.

@param \Cake\Event\Event $event The beforeDelete event that was fired.
@param \Cake\ORM\Entity $entity The entity that is going to be saved.

@return void
When you delete a record from a set you need to decrement the order of all records that were after it in the set .