BaseActiveRecordVersioned::getPreviousVersion PHP Method

getPreviousVersion() public method

public getPreviousVersion ( )
    public function getPreviousVersion()
    {
        $condition = 'id = :id';
        $params = array(':id' => $this->id);
        if ($this->version_id) {
            $condition .= ' and version_id < :version_id';
            $params[':version_id'] = $this->version_id;
        }
        return $this->model()->fromVersion()->find(array('condition' => $condition, 'params' => $params, 'order' => 'version_id desc'));
    }