/** Run the service and set result. */ protected function proceed() { $srv = new CashRegistersService(); switch ($this->action) { case 'get': if (isset($this->params['id'])) { $ret = $srv->get($this->params['id']); $this->succeed($ret); } else { $ret = $srv->search(array(array("label", "=", $this->params['label']))); if (count($ret) >= 1) { $this->succeed($ret[0]); } else { $this->succeed(null); } } break; case 'getAll': $this->succeed($srv->getAll()); break; } }