private function deleteEmail() { if ($this->get_request_method() !== 'DELETE') { $this->response('', API::STATUS_NOT_ACCEPTABLE); } $idEmail = (int) $this->_request['id']; if ($idEmail > 0) { $objeto = DBManual::getEmailByID($idEmail); if (!is_null($objeto)) { if (DBObject::deleteEmail($objeto)) { $success = array('status' => 'Sucesso', 'msg' => 'Email deletado com sucesso.'); $this->response($this->json($success), API::STATUS_OK); } else { $this->response('', API::STATUS_NO_CONTENT); } } else { $this->response('', API::STATUS_NOT_FOUND); } } else { $this->response('', API::STATUS_NO_CONTENT); } }
public static function searchEmails($id = null, $endereco = null, $contato = null) { $objetos = DBManual::searchEmails($id, $endereco, $contato); $json = array(); foreach ($objetos as $objeto) { $json[] = DBJson::emailToJson($objeto); } return $json; }