/** * 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; }
/** * @return \yii\db\ActiveQuery */ public function getParent() { return $this->hasOne(CustomerEntity::className(), ['entity_id' => 'parent_id']); }
/** * @return \yii\db\ActiveQuery */ public function getCustomer() { return $this->hasOne(CustomerEntity::className(), ['entity_id' => 'customer_id']); }