本文整理匯總了PHP中app\models\Product::deleteAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Product::deleteAll方法的具體用法?PHP Product::deleteAll怎麽用?PHP Product::deleteAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\models\Product
的用法示例。
在下文中一共展示了Product::deleteAll方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: beforeDelete
public function beforeDelete()
{
if (parent::beforeDelete()) {
Product::deleteAll(['cate_id' => $this->id]);
return true;
} else {
return false;
}
}
示例2: actionProductnamedelete
public function actionProductnamedelete()
{
$data = json_decode(file_get_contents("php://input"));
$userd = Product::deleteAll('sn=' . $data->id);
$arr = array('msg' => "Product Name deleted Successfully !!!", 'error' => '');
$jsn = json_encode($arr);
print_r($jsn);
}
示例3: actionDeleteall
public function actionDeleteall()
{
$role = UserRoleDetector::getUserRole();
Yii::$app->response->format = Response::FORMAT_JSON;
if ($role != 3 && $role != 4) {
echo json_encode(array('status' => 0, 'error_code' => Codes::$UNAUTHORIZED, 'errors' => StatusCodeMessage::$UNAUTHORIZED), JSON_PRETTY_PRINT);
} else {
$ids = json_decode($_REQUEST['ids']);
$stringIds = implode(",", $ids);
$connection = \Yii::$app->db;
if (Product::deleteAll('warehouse_id IN (' . $stringIds . ')')) {
echo json_encode(array('status' => 1, 'code' => 200, 'data' => 'deleted'), JSON_PRETTY_PRINT);
} else {
echo json_encode(array('status' => 0, 'error_code' => Codes::$BAD_REQUEST), JSON_PRETTY_PRINT);
}
}
}