public function createAction() { $entity = new Suscriptor(); $entity->load_from_array($this->request->getParam("suscriptor")); $same_email = load_suscriptor_where("email = '" . $entity->email . "'"); if ($same_email != null) { $this->flash->error("Dude! Chill, you're already suscribed, just relax and browse the list of repos..."); } else { if (save_suscriptor($entity)) { $this->flash->setSuccess("Thanks for suscribing! Stay tuned!"); } else { $this->flash->setError("Please enter a valid email address and try again"); } } $this->redirect_to(home_root_path_path()); }
function load_suscriptor($id) { return load_suscriptor_where("id = {$id}"); }