Issues with ExampleImportExportPlugin

I’m fiddling with GitHub - pkp/exampleImportExport: An example plugin demonstrating how to create an import/export plugin for OJS or OMP. but on OMP 3.1.2 it fails with:
Uncaught Error: Call to undefined method Application::get() in /home/mt/Projects/pkp/omp/plugins/importexport/exampleImportExport-master/ExampleImportExportPlugin.inc.php:53

I found I can work around that with:
$contextId = Application::getRequest()->getContext()->getId();
not sure if that’s the way though.
If I do that I end up with
PHP Fatal error: Uncaught Error: Class ‘Services’ not found in /home/mt/Projects/pkp/omp/plugins/importexport/exampleImportExport-master/ExampleImportExportPlugin.inc.php:108

How am I supposed to get the submissions?

regards Mark

Hi @M_T,

That code is written for OJS 3.2.0 or newer so won’t be compatible with OJS 3.1.2.

Note that plugins need to be installed in the right directory – you are using exampleImportExport-master when it should be exampleImportExport.

Your change to Application::get() is correct for 3.1.2; for getting submissions, you can use

$articleDao = DAORegistry::getDAO('ArticleDAO');
$submissions = $articleDao->getByContextId($contextId);

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Thanks,
I had to tweak it for omp, but that was the hint I needed.

1 Like