Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

35 rindas
766B

  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\rest;
  8. use Yii;
  9. /**
  10. * ViewAction implements the API endpoint for returning the detailed information about a model.
  11. *
  12. * @author Qiang Xue <qiang.xue@gmail.com>
  13. * @since 2.0
  14. */
  15. class ViewAction extends Action
  16. {
  17. /**
  18. * Displays a model.
  19. * @param string $id the primary key of the model.
  20. * @return \yii\db\ActiveRecordInterface the model being displayed
  21. */
  22. public function run($id)
  23. {
  24. $model = $this->findModel($id);
  25. if ($this->checkAccess) {
  26. call_user_func($this->checkAccess, $this->id, $model);
  27. }
  28. return $model;
  29. }
  30. }