本文整理汇总了PHP中app\models\Order::deleteAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::deleteAll方法的具体用法?PHP Order::deleteAll怎么用?PHP Order::deleteAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Order
的用法示例。
在下文中一共展示了Order::deleteAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionOrdermanage
public function actionOrdermanage()
{
$layout_data = array('username' => Yii::$app->session['username'], 'status' => 3);
$url = Yii::$app->basePath . "/web" . '/';
$this->layout_data = $layout_data;
$deadlinetime = time() - 1800;
$orders = Order::find()->where('createtime<:deadlinetime and status = 0', [':deadlinetime' => $deadlinetime])->all();
foreach ($orders as $key => $order) {
$file1 = $url . $order->frontpic;
$file2 = $url . $order->backpic;
if (file_exists($file1)) {
unlink($url . $order->frontpic);
}
if (file_exists($file2)) {
unlink($url . $order->backpic);
}
}
Order::deleteAll('createtime<:deadlinetime and status = 0', [':deadlinetime' => $deadlinetime]);
$Orders = Order::find()->where(['userid' => Yii::$app->session['userid']])->with('address')->OrderBy(['createtime' => SORT_DESC])->all();
$address = Address::find()->where(['userid' => Yii::$app->session['userid']])->all();
return $this->render('ordermanage', ['address' => $address, 'orders' => $Orders]);
}
示例2: actionDelete
/**
* Deletes an existing Client model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$model = Client::findOne($id);
Order::deleteAll(['id_client' => $model->id]);
$model->delete();
return $this->redirect(['index']);
}