backend\models\CancelOrderForm::__construct PHP Method

__construct() public method

Creates a form model given a order id.
public __construct ( string $id, array $config = [] )
$id string
$config array name-value pairs that will be used to initialize the object properties
    public function __construct($id, $config = [])
    {
        if (empty($id) || !is_numeric($id)) {
            throw new InvalidParamException('参数错误!');
        }
        $this->_order = Order::findOne($id);
        if (!$this->_order) {
            throw new InvalidParamException('未找到该订单!');
        }
        parent::__construct($config);
    }