public function getPurchase() { return $this->hasOne(Purchase::className(), ['id' => 'purchase_id']); }
/** * Deletes an existing Purchase model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionDelete($id) { $model = $this->findModel($id); $api = new ApiPurchase(['modelClass' => Purchase::className()]); $api->delete($id, $model); return $this->redirect(['index']); }