original_string: public function importAuthors($oldArticleId, $article)
      {
          $this->consoleOutput->writeln("Reading authors...");
  
          $authorSql = "SELECT first_name, last_name, email, seq FROM authors " .
              "WHERE submission_id = :id ORDER BY first_name, last_name, email";
          $authorStatement = $this->dbalConnection->prepare($authorSql);
          $authorStatement->bindValue('id', $oldArticleId);
          $authorStatement->execute();
  
          $authors = $authorStatement->fetchAll();
          foreach ($authors as $pkpAuthor) {
              $author = new Author();
              $author->setCurrentLocale('en');
              $author->setFirstName(!empty($pkpAuthor['first_name']) ? $pkpAuthor['first_name'] : '-');
              $author->setLastName(!empty($pkpAuthor['last_name']) ? $pkpAuthor['last_name'] : '-');
              $author->setEmail(
                  !empty($pkpAuthor['email']) && $pkpAuthor['email'] !== '-' ?
                      $pkpAuthor['email'] :
                      'author@example.com'
              );
  
              $articleAuthor = new ArticleAuthor();
              $articleAuthor->setAuthor($author);
              $articleAuthor->setArticle($article);
              $articleAuthor->setAuthorOrder(!empty($pkpAuthor['seq']) ? $pkpAuthor['seq'] : 0);
          }
      }
code: public function importAuthors($oldArticleId, $article)
      {
          $this->consoleOutput->writeln("Reading authors...");
  
          $authorSql = "SELECT first_name, last_name, email, seq FROM authors " .
              "WHERE submission_id = :id ORDER BY first_name, last_name, email";
          $authorStatement = $this->dbalConnection->prepare($authorSql);
          $authorStatement->bindValue('id', $oldArticleId);
          $authorStatement->execute();
  
          $authors = $authorStatement->fetchAll();
          foreach ($authors as $pkpAuthor) {
              $author = new Author();
              $author->setCurrentLocale('en');
              $author->setFirstName(!empty($pkpAuthor['first_name']) ? $pkpAuthor['first_name'] : '-');
              $author->setLastName(!empty($pkpAuthor['last_name']) ? $pkpAuthor['last_name'] : '-');
              $author->setEmail(
                  !empty($pkpAuthor['email']) && $pkpAuthor['email'] !== '-' ?
                      $pkpAuthor['email'] :
                      'author@example.com'
              );
  
              $articleAuthor = new ArticleAuthor();
              $articleAuthor->setAuthor($author);
              $articleAuthor->setArticle($article);
              $articleAuthor->setAuthorOrder(!empty($pkpAuthor['seq']) ? $pkpAuthor['seq'] : 0);
          }
      }
code_tokens: public function importAuthors ( $ oldArticleId , $ article ) { $ this -> consoleOutput -> writeln ( "Reading authors..." ) ; $ authorSql = "SELECT first_name, last_name, email, seq FROM authors " . "WHERE submission_id = :id ORDER BY first_name, last_name, email" ; $ authorStatement = $ this -> dbalConnection -> prepare ( $ authorSql ) ; $ authorStatement -> bindValue ( 'id' , $ oldArticleId ) ; $ authorStatement -> execute ( ) ; $ authors = $ authorStatement -> fetchAll ( ) ; foreach ( $ authors as $ pkpAuthor ) { $ author = new Author ( ) ; $ author -> setCurrentLocale ( 'en' ) ; $ author -> setFirstName ( ! empty ( $ pkpAuthor [ 'first_name' ] ) ? $ pkpAuthor [ 'first_name' ] : '-' ) ; $ author -> setLastName ( ! empty ( $ pkpAuthor [ 'last_name' ] ) ? $ pkpAuthor [ 'last_name' ] : '-' ) ; $ author -> setEmail ( ! empty ( $ pkpAuthor [ 'email' ] ) && $ pkpAuthor [ 'email' ] !== '-' ? $ pkpAuthor [ 'email' ] : 'author@example.com' ) ; $ articleAuthor = new ArticleAuthor ( ) ; $ articleAuthor -> setAuthor ( $ author ) ; $ articleAuthor -> setArticle ( $ article ) ; $ articleAuthor -> setAuthorOrder ( ! empty ( $ pkpAuthor [ 'seq' ] ) ? $ pkpAuthor [ 'seq' ] : 0 ) ; } }
docstring: Imports authors of the given article.
  @param int $oldArticleId Old article's ID
  @param Article $article  Newly imported Article entity
docstring_tokens: Imports authors of the given article .