frontend/models/VoucherForm.php
/**
     * Checks if user currently has active plan
     *
     * @return viod
     */
Checks if user currently has active plan
@return viod
Checks if user currently has active plan @return viod
public function validateUserPlan()
    {
        if (!$this->hasErrors()) {
            $user = User::findOne($this->user_id);
            $voucher = Voucher::findByCode($this->voucher);
            if ($user->plan != null && ($voucher->product->type != $user->plan->product_type)) {
                $this->addError('user_id', 'You currently have active plan. You may use this voucher after your plan will expire.');
            }
        }
    }
public function validateUserPlan ( ) { if ( ! $ this -> hasErrors ( ) ) { $ user = User :: findOne ( $ this -> user_id ) ; $ voucher = Voucher :: findByCode ( $ this -> voucher ) ; if ( $ user -> plan != null && ( $ voucher -> product -> type != $ user -> plan -> product_type ) ) { $ this -> addError ( 'user_id' , 'You currently have active plan. You may use this voucher after your plan will expire.' ) ; } } }
Checks if user currently has active plan
 @return viod
Checks if user currently has active plan @return viod