I’m using the following code from to select the IssueID for a publishedArticle object
$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
$issueDao = DAORegistry::getDAO('issueDAO');
$article = $publishedArticleDao->getById($submissionId);
$issueId = $article->getIssueId();
$issue = $issueDao->getById($issueId);
However, I always get NULL for $issueId, even though the selected submission is published and assigned an issue. I’d appreciate all help on this issue.
What version of OJS are you using?
Have you tried:
$article = $publishedArticleDao->getByArticleId($submissionId);
That worked perfectly! Wonder why it didn’t select the IssueId when using
$article = $publishedArticleDao->getById($submissionId);?
That looks like a bug in 3.1.2-1. It appears to be resolved in 3.1.2-2 via Fix incomplete fetch of published_submissions columns (leading to PHP warnings) · Issue #4907 · pkp/pkp-lib · GitHub
This is substantially refactored in 3.2, and I didn’t fully trace the code there.