コード例 #1
0
ファイル: Items.php プロジェクト: 4fnsk/inetra-test
 /**
  * Returns own parents as array of AR-Items.
  * @param \stdClass $parents.
  * @return array
  */
 protected function getOwnParents($parents)
 {
     $links = $this->getUpLinks()->all();
     $out = [];
     foreach ($links as $link) {
         $parents->set[] = $link->from;
         $out[] = Items::findOne($link->from);
     }
     return $out;
 }
コード例 #2
0
ファイル: ItemsController.php プロジェクト: panin87/travel
 /**
  * Finds the Items model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Items the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Items::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }