/** * Runs post process tasks/scripts */ protected function postProcess() { switch (count($this->resourceArray)) { case 0: parent::postProcess(); break; case 1: $event = new ResourcePostProcess($this->getServiceName(), $this->getFullPathName('.') . '.' . $this->resourceArray[0], $this->request, $this->response, $this->resourcePath); /** @noinspection PhpUnusedLocalVariableInspection */ $results = \Event::fire($event); // copy the event response back to this response $this->response = $event->response; $event = new ResourcePostProcess($this->getServiceName(), $this->getFullPathName('.') . '.{table_name}', $this->request, $this->response, $this->resourcePath); /** @noinspection PhpUnusedLocalVariableInspection */ $results = \Event::fire($event); $this->response = $event->response; break; case 2: $event = new ResourcePostProcess($this->getServiceName(), $this->getFullPathName('.') . '.' . $this->resourceArray[0] . '.' . $this->resourceArray[1], $this->request, $this->response, $this->resourcePath); /** @noinspection PhpUnusedLocalVariableInspection */ $results = \Event::fire($event); $this->response = $event->response; // todo how to handle proper response for more than one result? $event = new ResourcePostProcess($this->getServiceName(), $this->getFullPathName('.') . '.{table_name}.{id}', $this->request, $this->response, $this->resourcePath); /** @noinspection PhpUnusedLocalVariableInspection */ $results = \Event::fire($event); $this->response = $event->response; break; default: // Do nothing is all we got? break; } }