public function changeSubscriptionTo($package)
    {
        if ($this->_mixer->hasSubscription(false) && !$this->_mixer->subscription->package->eql($package)) {
            $diff = max(0, $package->duration - $this->_mixer->subscription->package->duration);

            $end_date = clone $this->_mixer->subscription->endDate;
            $end_date->addSeconds($diff);

            $this->_mixer->subscription->package = $package;
            $this->_mixer->subscription->endDate = $end_date;
        }

        return $this->_mixer->subscription;
    }
public function changeSubscriptionTo($package)
    {
        if ($this->_mixer->hasSubscription(false) && !$this->_mixer->subscription->package->eql($package)) {
            $diff = max(0, $package->duration - $this->_mixer->subscription->package->duration);

            $end_date = clone $this->_mixer->subscription->endDate;
            $end_date->addSeconds($diff);

            $this->_mixer->subscription->package = $package;
            $this->_mixer->subscription->endDate = $end_date;
        }

        return $this->_mixer->subscription;
    }
public function changeSubscriptionTo ( $ package ) { if ( $ this -> _mixer -> hasSubscription ( false ) && ! $ this -> _mixer -> subscription -> package -> eql ( $ package ) ) { $ diff = max ( 0 , $ package -> duration - $ this -> _mixer -> subscription -> package -> duration ) ; $ end_date = clone $ this -> _mixer -> subscription -> endDate ; $ end_date -> addSeconds ( $ diff ) ; $ this -> _mixer -> subscription -> package = $ package ; $ this -> _mixer -> subscription -> endDate = $ end_date ; } return $ this -> _mixer -> subscription ; }
Upgrades a person current subscription to a new one. It calculates the duration
difference of the old package and new package and adds to the remaining time.

@param ComSubscriptionsDomainEntityPackage $package

@return ComSubscriptionsDomainEntitySubscription
Upgrades a person current subscription to a new one . It calculates the duration difference of the old package and new package and adds to the remaining time .