本文整理汇总了PHP中app\models\Customer::findOne方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::findOne方法的具体用法?PHP Customer::findOne怎么用?PHP Customer::findOne使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Customer
的用法示例。
在下文中一共展示了Customer::findOne方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findModel
/**
* Finds the Customer model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Customer the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Customer::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
示例2: actionIndexWithRelationships
public function actionIndexWithRelationships()
{
$room_id = Yii::$app->request->get('room_id', null);
$reservation_id = Yii::$app->request->get('reservation_id', null);
$customer_id = Yii::$app->request->get('customer_id', null);
$roomSelected = null;
$reservationSelected = null;
$customerSelected = null;
if ($room_id != null) {
$roomSelected = Room::findOne($room_id);
$rooms = array($roomSelected);
$reservations = $roomSelected->reservations;
$customers = $roomSelected->customers;
} elseif ($reservation_id != null) {
$reservationSelected = Reservation::findOne($reservation_id);
$rooms = array($reservationSelected->room);
$reservations = array($reservationSelected);
$customers = array($reservationSelected->customer);
} elseif ($customer_id != null) {
$customerSelected = Customer::findOne($customer_id);
$rooms = $customerSelected->rooms;
$reservations = $customerSelected->reservations;
$customers = array($customerSelected);
} else {
$rooms = Room::find()->all();
$reservations = Reservation::find()->all();
$customers = Customer::find()->all();
}
return $this->render('indexWithRelationShips', compact('roomSelected', 'reservationSelected', 'customerSelected', 'rooms', 'reservations', 'customers'));
}
示例3: actionGetCustomerDetail
public function actionGetCustomerDetail($customerID)
{
$customer = Customer::findOne($customerID);
echo Json::encode($customer);
}
示例4: actionUpdate
/**
* Updates an existing PurchaseOrder model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
$updatePODetail = new PurchaseOrderDetail();
$poDetails = PurchaseOrderDetail::find()->where(['purchaseorderdetail_purchaseorderid' => $id])->orderBy('purchaseorderdetail_id')->all();
$product = Product::find()->where(['product_type' => 'p'])->orderBy('product_id')->all();
$service = Product::find()->where(['product_type' => 's'])->orderBy('product_id')->all();
$customer = Customer::find()->orderBy('customer_name')->all();
$company = Company::findOne(1);
$customerID = $model->purchaseorder_customerid;
$thisCustomer = Customer::findOne($customerID);
$uid = Yii::$app->user->identity->user_id;
$uname = Yii::$app->user->identity->user_name;
if (isset($_POST['description'])) {
$poDetailList = $_POST['description'];
$customer_id = $_POST['customer-list'];
$po_id = $_POST['po_id'];
$po_no = $_POST['po_no'];
$po_date = $_POST['po_date'];
$productType = $_POST['productType'];
$qty = $_POST['qty'];
$unit = $_POST['unit'];
$cost = $_POST['cost'];
$hidden_price = $_POST['hidden_price'];
$hidden_gst = $_POST['hidden_gst'];
$hidden_tax_code = $_POST['hidden_tax_code'];
$hidden_tax_rate = $_POST['hidden_tax_rate'];
$hidden_price_gst = $_POST['hidden_price_gst'];
$hidden_total = $_POST['hidden_total'];
$hidden_gsttotal = $_POST['hidden_gsttotal'];
$hidden_gstpricetotal = $_POST['hidden_gstpricetotal'];
$hidden_id = $_POST['hidden_id'];
$hidden_poid = $_POST['hidden_poid'];
$hidden_product_name = $_POST['hidden_product_name'];
if ($updateQPODetail != NULL) {
$updateQPODetail = $this->findModel($id);
$updateQPODetail->purchaseorder_id = $po_id;
$updateQPODetail->purchaseorder_no = $po_no;
$updateQPODetail->purchaseorder_date = $po_date;
$updateQPODetail->purchaseorder_date_transaction = $po_date;
$updateQPODetail->purchaseorder_date_delete = $po_date;
$updateQPODetail->purchaseorder_customerid = $customer_id;
$updateQPODetail->purchaseorder_supplierid = 1;
$updateQPODetail->purchaseorder_supplier_quotation_no = 11;
$updateQPODetail->purchaseorder_createid = $uid;
$updateQPODetail->purchaseorder_createname = $uname;
$updateQPODetail->purchaseorder_remark = "lol";
$updateQPODetail->purchaseorder_system = "y";
$updateQPODetail->purchaseorder_partno = "y";
$updateQPODetail->purchaseorder_charge = 123;
$updateQPODetail->purchaseorder_update_stock_status = "y";
$updateQPODetail->purchaseorder_status = "y";
$updateQPODetail->purchaseorder_tax_label = "lol";
$updateQPODetail->purchaseorder_tax_percent = 1;
$updateQPODetail->purchaseorder_tax_amount = 100;
$updateQPODetail->purchaseorder_printed_status = "y";
$updateQPODetail->purchaseorder_revision = 1;
$updateQPODetail->purchaseorder_parts_total = $hidden_total;
$updateQPODetail->purchaseorder_deleteid = 1;
$updateQPODetail->purchaseorder_payment_status = "y";
$updateQPODetail->purchaseorder_no_user_format = "lol";
$updateQPODetail->purchaseorder_auto_generate = "y";
$updateQPODetail->purchaseorder_creditorid = 1;
$updateQPODetail->purchaseorder_purchase_return = 123;
$updateQPODetail->purchaseorder_payment_paid_thus_far = 123;
$updateQPODetail->purchaseorder_outstanding_amount = 123;
$updateQPODetail->purchaseorder_projectid = 1;
$updateQPODetail->purchaseorder_gst_payable = $hidden_gsttotal;
$updateQPODetail->purchaseorder_total_amount = $hidden_gstpricetotal;
$updateQPODetail->save();
foreach ($poDetailList as $key => $n) {
if ($hidden_poid[$key] != $id || $hidden_poid[$key] == NULL || $hidden_poid[$key] == '') {
if ($unit[$key] == NULL) {
$unit[$key] = "-";
}
$newPODetail = new PurchaseOrderDetail();
$newPODetail->purchaseorderdetail_purchaseorderid = $po_id;
$newPODetail->purchaseorderdetail_productid = $n;
$newPODetail->purchaseorderdetail_partno = "lol";
$newPODetail->purchaseorderdetail_productname = $hidden_product_name[$key];
$newPODetail->purchaseorderdetail_unit = $qty[$key];
$newPODetail->purchaseorderdetail_unitname = $unit[$key];
$newPODetail->purchaseorderdetail_product_cost = $cost[$key];
$newPODetail->purchaseorderdetail_price = $hidden_price[$key];
$newPODetail->purchaseorderdetail_unitsent = 0;
$newPODetail->purchaseorderdetail_status = "y";
$newPODetail->purchaseorderdetail_tax_code = $hidden_tax_code[$key];
$newPODetail->purchaseorderdetail_tax_rate = $hidden_tax_rate[$key];
$newPODetail->purchaseorderdetail_tax_amount = $hidden_gst[$key];
$newPODetail->purchaseorderdetail_total_amount = $hidden_price_gst[$key];
$newPODetail->purchaseorderdetail_gst_status = 1;
$newPODetail->save();
} elseif ($hidden_poid[$key] == $id) {
$poid = $hidden_id[$key];
//.........这里部分代码省略.........