protected function getDirectlyRelatedRecords(&$record) { $creditsPackageDAO = new CreditsPackageDAO(); $downloadDAO = new DownloadDAO(); $clipboardDAO = new ClipboardDAO(); $fileDAO = new FileDAO(); $forumThreadDAO = new ForumThreadDAO(); $forumPostDAO = new ForumPostDAO(); $authorDAO = new AuthorDAO(); return array('CreditsPackageDAO' => $creditsPackageDAO->getListByForeignKey('userId', $record['id']), 'DownloadDAO' => $downloadDAO->getListByForeignKey('userId', $record['id']), 'ClipboardDAO' => $clipboardDAO->getListByForeignKey('userId', $record['id']), 'FileDAO' => $fileDAO->getListByRecord('user', $record['id']), 'ForumThreadDAO' => $forumThreadDAO->getListByForeignKey('userId', $record['id']), 'ForumPostDAO' => $forumPostDAO->getListByForeignKey('userId', $record['id']), 'AuthorDAO' => $authorDAO->getListByForeignKey('userId', $record['id'])); }
<?php //Include DAO and VO for author include '/VO/AuthorVO.php'; include '/DAO/AuthorDAO.php'; //Get all data from http $postdata = file_get_contents("php://input"); $request = json_decode($postdata); //Separate data in diferent variables @($name = $request->name); @($email = $request->email); @($pass = $request->password); @($address = $request->address); @($id = $request->id); @($id_city = $request->id_city); @($id_department = $request->id_department); @($photo = $request->photo); //Create an author with all info from http $authorVO = new AuthorVO('', $name, $email, $pass, $address, $id, $id_city, $id_department, $photo); $authorDAO = new AuthorDAO(); //Save author in DB and echo its return echo $authorDAO->save($authorVO);
<?php //Include DAO and VO for author include '/VO/AuthorVO.php'; include '/DAO/AuthorDAO.php'; //Get all data from http $postdata = file_get_contents("php://input"); $request = json_decode($postdata); //Separate data in diferent variables @($email = $request->email); @($passwd = $request->passwd); //Create an empty author $authorDAO = new AuthorDAO(); //Fetch an author by his email $authorVO = $authorDAO->getByEmail($email); //Store author info in Session variable $authorVO[0]->toSession(); //If login is valid, send 'VALID' if ($authorVO[0]->getPassword() == $passwd) { echo 'VALID'; } else { echo 'INVALID'; }