public static function insertIssue($app, $issue, $line) { $tweets = PrepareTweets::generateTweets($app, $issue, $line); if ($app['debug']) { return $tweets; } else { // insert the issue to the database if no id was found for it (aka. new // issue) $app['db']->insert('issues', array('line' => $line, 'title' => $issue['title'], 'description' => $issue['description'], 'pubDate' => $issue['pubDate'], 'start' => $issue['start'], 'end' => $issue['end'], 'guid' => $issue['guid'])); Twitter::broadcastTweets($app, $tweets, $issue['guid']); // return the id of the issue that we've just inserted return $app['db']->lastInsertId(); } }
public static function getIssueByTweet($app, $tweetId) { $getIssue = 'SELECT i.id, i.line, i.title, i.description, i.time_added, t.tweetId, t.tweet FROM issues i, tweets t WHERE i.guid = t.guid AND t.tweetId = ?'; $issue = $app['db']->fetchAssoc($getIssue, array($tweetId)); $issue['freshGeneration'] = PrepareTweets::generateTweets($app, $issue, $issue['line']); return $issue; }