update( 'INSERT INTO submission_supplementary_files (file_id, revision) VALUES (?, ?)', array( (int) $supplementaryFile->getFileId(), (int) $supplementaryFile->getRevision(), ) ); return $supplementaryFile; } /** * @see SubmissionFileDAODelegate::update() * @param $suppFile SupplementaryFile * @param $previousFile SupplementaryFile * @return boolean True if success. */ function updateObject($suppFile, $previousFile) { // Update the parent class table first. if (!parent::updateObject($suppFile, $previousFile)) return false; // Now update the supplementary file table. $this->update( 'UPDATE submission_supplementary_files SET file_id = ?, revision = ? WHERE file_id = ? AND revision = ?', array( (int)$suppFile->getFileId(), (int)$suppFile->getRevision(), (int)$previousFile->getFileId(), (int)$previousFile->getRevision() ) ); return true; } /** * @copydoc SubmissionFileDAODelegate::deleteObject() */ function deleteObject($submissionFile) { // First delete the submission file entry. if (!parent::deleteObject($submissionFile)) return false; // Delete the supplementary file entry. $this->update( 'DELETE FROM submission_supplementary_files WHERE file_id = ? AND revision = ?', array( (int) $submissionFile->getFileId(), (int) $submissionFile->getRevision() ) ); return true; } /** * @copydoc DAO::getLocaleFieldNames() */ function getLocaleFieldNames() { return array_merge( parent::getLocaleFieldNames(), array( 'creator', 'subject', 'description', 'publisher', 'sponsor', 'source', ) ); } /** * @copydoc DAO::getAdditionalFieldNames() */ function getAdditionalFieldNames() { return array_merge( parent::getAdditionalFieldNames(), array( 'dateCreated', 'language', ) ); } /** * @copydoc SubmissionFileDAODelegate::newDataObject() */ function newDataObject() { return new SupplementaryFile(); } } ?>