protected function _getOldValues(Entity $entity)
    {
        $config = $this->getConfig();
        $fields = array_merge($config['scope'], [$config['order']]);

        $values = [];
        foreach ($fields as $field) {
            if ($entity->isDirty($field)) {
                $values[$field] = $entity->getOriginal($field);
            } elseif ($entity->has($field)) {
                $values[$field] = $entity->get($field);
            }
        }

        if (count($fields) != count($values)) {
            $primaryKey = $entity->get($this->_table->getPrimaryKey());
            $entity = $this->_table->get($primaryKey, ['fields' => $fields]);
            $values = $entity->extract($fields);
        }

        $order = $values[$config['order']];
        unset($values[$config['order']]);

        return [$order, $values];
    }
protected function _getOldValues(Entity $entity)
    {
        $config = $this->getConfig();
        $fields = array_merge($config['scope'], [$config['order']]);

        $values = [];
        foreach ($fields as $field) {
            if ($entity->isDirty($field)) {
                $values[$field] = $entity->getOriginal($field);
            } elseif ($entity->has($field)) {
                $values[$field] = $entity->get($field);
            }
        }

        if (count($fields) != count($values)) {
            $primaryKey = $entity->get($this->_table->getPrimaryKey());
            $entity = $this->_table->get($primaryKey, ['fields' => $fields]);
            $values = $entity->extract($fields);
        }

        $order = $values[$config['order']];
        unset($values[$config['order']]);

        return [$order, $values];
    }
protected function _getOldValues ( Entity $ entity ) { $ config = $ this -> getConfig ( ) ; $ fields = array_merge ( $ config [ 'scope' ] , [ $ config [ 'order' ] ] ) ; $ values = [ ] ; foreach ( $ fields as $ field ) { if ( $ entity -> isDirty ( $ field ) ) { $ values [ $ field ] = $ entity -> getOriginal ( $ field ) ; } elseif ( $ entity -> has ( $ field ) ) { $ values [ $ field ] = $ entity -> get ( $ field ) ; } } if ( count ( $ fields ) != count ( $ values ) ) { $ primaryKey = $ entity -> get ( $ this -> _table -> getPrimaryKey ( ) ) ; $ entity = $ this -> _table -> get ( $ primaryKey , [ 'fields' => $ fields ] ) ; $ values = $ entity -> extract ( $ fields ) ; } $ order = $ values [ $ config [ 'order' ] ] ; unset ( $ values [ $ config [ 'order' ] ] ) ; return [ $ order , $ values ] ; }
Get old order and scope values.

@param \Cake\ORM\Entity $entity Entity.

@return array
Get old order and scope values .