/** * @return \yii\db\ActiveQuery */ public function getPin() { return $this->hasOne(Pin::className(), ['id' => 'pin_id']); }
/** * Finds the Pin model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Pin the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Pin::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getPins() { return $this->hasMany(Pin::className(), ['image_id' => 'id']); }