src/AppDomain/CommandHandler.php
/**
     * Validate an AddPaperManually command, and publish PaperAdded on success
     *
     * @param AddPaperManually $command
     * @throws \Exception
     */
Validate an AddPaperManually command, and publish PaperAdded on success
@param AddPaperManually $command
@throws \Exception
Validate an AddPaperManually command and publish PaperAdded on success @param AddPaperManually $command @throws \ Exception
public function addPaperManually(AddPaperManually $command)
    {
        if ($this->findIdByManuscriptNo($command->manuscriptNo)) {
            throw new \Exception('A paper with this manuscript no. is already in statusbase');
        }
        $subjectAreaIds = [$command->subjectAreaId1];
        if ($command->subjectAreaId2) {
            $subjectAreaIds[] = $command->subjectAreaId2;
        }
        $event = (new PaperAdded(
            $command->manuscriptNo,
            $command->correspondingAuthor,
            $command->articleTypeCode,
            $command->revision,
            $command->hadAppeal,
            $subjectAreaIds,
            'Manual',
            $command->insightDecision,
            $command->insightComment
        ));
        $this->publish($event);
    }
public function addPaperManually ( AddPaperManually $ command ) { if ( $ this -> findIdByManuscriptNo ( $ command -> manuscriptNo ) ) { throw new \ Exception ( 'A paper with this manuscript no. is already in statusbase' ) ; } $ subjectAreaIds = [ $ command -> subjectAreaId1 ] ; if ( $ command -> subjectAreaId2 ) { $ subjectAreaIds [ ] = $ command -> subjectAreaId2 ; } $ event = ( new PaperAdded ( $ command -> manuscriptNo , $ command -> correspondingAuthor , $ command -> articleTypeCode , $ command -> revision , $ command -> hadAppeal , $ subjectAreaIds , 'Manual' , $ command -> insightDecision , $ command -> insightComment ) ) ; $ this -> publish ( $ event ) ; }
Validate an AddPaperManually command, and publish PaperAdded on success
 @param AddPaperManually $command
 @throws \Exception
Validate an AddPaperManually command and publish PaperAdded on success @param AddPaperManually $command @throws \ Exception