public function sendAction() { if ($this->request->isPost()) { $sender = User::findFirst($this->request->getPost("senderId", "int", 0)); $recipient = User::findFirst($this->request->getPost("recipientId", "int", 0)); $amount = $this->request->getPost("amount", "float", 0); $transaction = new Transaction(); $result = $sender->sendMoney($amount, $recipient, $transaction); if ($result === false) { foreach ($sender->getErrors() as $error) { $this->flashSession->error($error); } } else { $this->flashSession->success("transaction processed successfully"); } } return $this->response->redirect("/", true); }