ArticleDAO::insertObject PHP Method

insertObject() public method

Insert a new Article.
public insertObject ( $article )
$article Article
    function insertObject($article)
    {
        $article->stampModified();
        $this->update(sprintf('INSERT INTO submissions
				(locale, context_id, section_id, stage_id, language, comments_to_ed, citations, date_submitted, date_status_modified, last_modified, status, submission_progress, current_round, pages, fast_tracked, hide_author)
				VALUES
				(?, ?, ?, ?, ?, ?, ?, %s, %s, %s, ?, ?, ?, ?, ?, ?)', $this->datetimeToDB($article->getDateSubmitted()), $this->datetimeToDB($article->getDateStatusModified()), $this->datetimeToDB($article->getLastModified())), array($article->getLocale(), (int) $article->getContextId(), (int) $article->getSectionId(), (int) $article->getStageId(), $article->getLanguage(), $article->getCommentsToEditor(), $article->getCitations(), $article->getStatus() === null ? STATUS_QUEUED : $article->getStatus(), $article->getSubmissionProgress() === null ? 1 : $article->getSubmissionProgress(), $article->getCurrentRound() === null ? 1 : $article->getCurrentRound(), $article->getPages(), (int) $article->getFastTracked(), (int) $article->getHideAuthor()));
        $article->setId($this->getInsertId());
        $this->updateLocaleFields($article);
        // Insert authors for this article
        $authors = $article->getAuthors();
        for ($i = 0, $count = count($authors); $i < $count; $i++) {
            $authors[$i]->setSubmissionId($article->getId());
            $this->authorDao->insertObject($authors[$i]);
        }
        return $article->getId();
    }