Skip to content

Instantly share code, notes, and snippets.

@kamlekar
Last active September 21, 2016 10:10
Show Gist options
  • Save kamlekar/52721f3647a50a59a4ef65b4f4e02283 to your computer and use it in GitHub Desktop.
Save kamlekar/52721f3647a50a59a4ef65b4f4e02283 to your computer and use it in GitHub Desktop.
public function getProjects($interpreter){
$result = new stdClass();
$userId = $interpreter->getUser()->user_id;
$data = $interpreter->getData()->data;
$db = Master::getDBConnectionManager();
$db->beginTransaction();
try{
// functionality here
$projects = $db->getProjects($userId);
$result->projectName = $projects->name;
$result->id = $projects->id;
$db->commitTransaction();
}
catch(Exception $e){
$db->abortTransaction();
Master::getLogManager()->log(DEBUG, MOD_MAIN, "Edit comment");
Master::getLogManager()->log(DEBUG, MOD_MAIN, $e);
$result->status = "fail";
$result->message = "Exception occured";
}
return $result;
}
public function getStocks($interpreter){
$result = new stdClass();
$userId = $interpreter->getUser()->user_id;
$data = $interpreter->getData()->data;
$db = Master::getDBConnectionManager();
$db->beginTransaction();
try{
// functionality here
$stocks = $db->getStocks($userId);
$result->id = $stocks->id
$db->commitTransaction();
}
catch(Exception $e){
$db->abortTransaction();
Master::getLogManager()->log(DEBUG, MOD_MAIN, "Edit comment");
Master::getLogManager()->log(DEBUG, MOD_MAIN, $e);
$result->status = "fail";
$result->message = "Exception occured";
}
return $result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment