Regarding PUT: PHP does not support it officially and the solutions are a bit hacky so I chose to not implement them.
The global variables are passed to the Request class:

https://github.com/owncloud/apps/blob/master/appframework/dependencyinjection/dicontainer.php#L61

and accessed in the controller

https://github.com/owncloud/apps/blob/master/appframework/controller/controller.php#L77

I'll add more globals like $_SERVER for the next release, not sure about PUT and DELETE though. If there is a clean, bugfree and working solution, we could include it ;)

The addHeader method is correct for now because I forgot to provide/didnt think of a NotFoundResponse :) there could also be a 403 response named ForbiddenResponse. Easy to implement and unittest, im looking forward to a potential PR ;)

You can catch the exception from the mapper with a try catch block when you use a find() method. renderJSON also supports an error response by passing an error message, see http://doc.owncloud.org/server/5.0/developer_manual/app/appframework/api/controller_controller.html

I have updated the app according the suggestions. Got couple more
questions regarding the app framework:

* Is there anyway to obtain PUT request data like I do with POST?
* Currently, I am using addHeader method to status code of responses.
It looks a little bit hacky, not sure whether this is the right thing
to do.
* Seems that when there is a exception thrown in the mapper object,
the controller cannot catch it? I want to return json containing error
code to client side when there is an exception.


Thanks, for input and help from all of you :)
_______________________________________________
Owncloud mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/owncloud

_______________________________________________
Owncloud mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/owncloud

Reply via email to