public function changeClass($className = false, $fieldValues = false)
    {
        if (!$className) {
            return $this;
        }

        $this->_record[static::_cn('Class')] = $className;
        $ActiveRecord = new $className($this->_record, true, $this->isPhantom);

        if ($fieldValues) {
            $ActiveRecord->setFields($fieldValues);
        }

        if (!$this->isPhantom) {
            $ActiveRecord->save();
        }

        return $ActiveRecord;
    }
public function changeClass($className = false, $fieldValues = false)
    {
        if (!$className) {
            return $this;
        }

        $this->_record[static::_cn('Class')] = $className;
        $ActiveRecord = new $className($this->_record, true, $this->isPhantom);

        if ($fieldValues) {
            $ActiveRecord->setFields($fieldValues);
        }

        if (!$this->isPhantom) {
            $ActiveRecord->save();
        }

        return $ActiveRecord;
    }
public function changeClass ( $ className = false , $ fieldValues = false ) { if ( ! $ className ) { return $ this ; } $ this -> _record [ static :: _cn ( 'Class' ) ] = $ className ; $ ActiveRecord = new $ className ( $ this -> _record , true , $ this -> isPhantom ) ; if ( $ fieldValues ) { $ ActiveRecord -> setFields ( $ fieldValues ) ; } if ( ! $ this -> isPhantom ) { $ ActiveRecord -> save ( ) ; } return $ ActiveRecord ; }
Used to instantiate a new model of a different class with this model's field's. Useful when you have similar classes or subclasses with the same parent.

@param string $className If you leave this blank the return will be $this
@param array $fieldValues Optional. Any field values you want to override.
@return static A new model of a different class with this model's field's. Useful when you have similar classes or subclasses with the same parent.
Used to instantiate a new model of a different class with this model s field s . Useful when you have similar classes or subclasses with the same parent .