frontend\models\PayOrderForm::__construct PHP Method

__construct() public method

Creates a form model given an order sn.
public __construct ( string $orderSn, array $config = [] )
$orderSn string
$config array name-value pairs that will be used to initialize the object properties
    public function __construct($orderSn, $config = [])
    {
        if (empty($orderSn) || !is_string($orderSn)) {
            throw new InvalidParamException('订单号错误!');
        }
        $this->_order = Order::find()->where(['and', ['order_sn' => $orderSn], ['user_id' => Yii::$app->user->id], ['<>', 'status', Order::STATUS_DELETED]])->one();
        if (!$this->_order) {
            throw new InvalidParamException('您没有该订单!');
        }
        parent::__construct($config);
    }