Friday 15 June 2012 1:34:18 pm - 2 replies
When using the REST API the modules repositories don't get initialised. In index.php we have this 2 lines:
// Initialize module loading$moduleRepositories = eZModule::activeModuleRepositories(); eZModule::setGlobalPathList( $moduleRepositories );
but this two lines are missing in index_rest.php.
This can produce several problems when coding inside the controller of the REST API, for example the content/publish operation is not available, so this code won't work:
eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $object->attribute( 'id' ), 'version' => $object->attribute( 'current_version' ) ) );
I have tried it and the object doesn't get published.
Any reasons why the modules repositories are not loaded in index_rest.php?
Should this be considered a bug?
Saturday 16 June 2012 10:58:14 am
No idea why it does not do this.
Iirc Nico opened up a bug already about this in wit a while ago.
And if you look at the ezcontentsaging source code (at present day probably the biggest / more advanced user of ezrest api), what it does is to always call
$moduleRepositories = eZModule::activeModuleRepositories();
before unertaking any content related action
Monday 18 June 2012 11:58:00 am
Indeed, and here is the related bug report : http://issues.ez.no/18337
The idea for not fixing it was that the front-controller of the REST api was to be reworked. Still, on today's API the proposed fix works fine.
The alternative, as Gaetano mentioned, is to use the line he proposed on the fly.
Cheers !
You must be logged in to post messages in this topic!