コード例 #1
0
 /**
  * Delete a customer
  *
  * @param CustomerEntity the customer object
  */
 public function delete(CustomerEntity $customer)
 {
     $sql = "DELETE FROM Customer WHERE CustomerNumber = :id";
     $stmt = $this->db->prepare($sql);
     $result = $stmt->execute(["id" => $customer->getId()]);
     if (!$result) {
         throw new Exception("could not delete record");
     }
     return $result;
 }
コード例 #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getParent()
 {
     return $this->hasOne(CustomerEntity::className(), ['entity_id' => 'parent_id']);
 }
コード例 #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCustomer()
 {
     return $this->hasOne(CustomerEntity::className(), ['entity_id' => 'customer_id']);
 }