public static function GetAuthorsByArticle($p_articleNumber, $p_languageId = NULL) { global $g_ado_db; if (is_null($p_languageId)) { $langConstraint = "FALSE"; } else { $langConstraint = "aa.fk_language_id = {$p_languageId}"; } $queryStr = 'SELECT aa.fk_author_id, aa.fk_type_id FROM ' . self::TABLE . ' AS aa JOIN ' . AuthorType::TABLE . ' AS at WHERE aa.fk_article_number = ' . (int) $p_articleNumber . ' AND (aa.fk_language_id IS NULL OR ' . $langConstraint . ') AND aa.fk_type_id = at.id ORDER BY `order`'; $rows = $g_ado_db->GetAll($queryStr); $returnArray = array(); if (is_array($rows)) { foreach ($rows as $row) { $author = new Author($row['fk_author_id'], $row['fk_type_id']); if ($author->exists()) { $returnArray[] = $author; } } } return $returnArray; }
/** * Update * * @param GenericEvent $event * @return void */ public function update(GenericEvent $event) { $comment = $this->commentService->find($event['id']); $article = new \Article($comment->getLanguage()->getId(), $comment->getThread()->getNumber()); $authors = \ArticleAuthor::GetAuthorsByArticle($comment->getThread()->getNumber(), $comment->getLanguage()->getId()); $this->emailService->sendCommentNotification($comment, $article, $authors, $this->userService->getCurrentUser()); }