Beispiel #1
0
 public function indexAction()
 {
     if ($this->hasParam('station')) {
         $record = Station::findByShortCode($this->getParam('station'));
     } elseif ($this->hasParam('id')) {
         $id = (int) $this->getParam('id');
         $record = Station::find($id);
     } else {
         $this->dispatcher->forward(array('controller' => 'station', 'action' => 'list'));
         return false;
     }
     if (!$record instanceof Station || $record->deleted_at) {
         return $this->returnError('Station not found.');
     }
     return $this->returnSuccess(Station::api($record));
 }