mirror of
https://github.com/nextcloud/documentation.git
synced 2026-01-04 02:36:49 +07:00
added appframework api files
This commit is contained in:
@@ -3,7 +3,7 @@ API abstraction layer
|
||||
|
||||
.. sectionauthor:: Bernhard Posselt <nukeawhale@gmail.com>
|
||||
|
||||
Owncloud currently has a ton of static methods which is a very bad thing concerning testability. Therefore the appframework comes with an API abstraction layer (basically a `facade <http://en.wikipedia.org/wiki/Facade_pattern>`_) which is located in the appframework app at :file:`core/api.php`.
|
||||
ownCloud currently has a ton of static methods which is a very bad thing concerning testability. Therefore the appframework comes with an :php:class:`OCA\\AppFramework\\Core\\API` abstraction layer (basically a `facade <http://en.wikipedia.org/wiki/Facade_pattern>`_) which is located in the appframework app at :file:`core/api.php`.
|
||||
|
||||
If you find yourself in need to use more ownCloud internal static methods, add them to the API class in the appframework directory, like:
|
||||
|
||||
@@ -36,4 +36,3 @@ You could of course also simply inherit from the API class and overwrite the API
|
||||
|
||||
This will allow you to easily mock the API in your unittests.
|
||||
|
||||
.. note:: This will eventually be replaced with an internal Owncloud API layer.
|
||||
|
||||
@@ -3,7 +3,7 @@ Controllers
|
||||
|
||||
.. sectionauthor:: Bernhard Posselt <nukeawhale@gmail.com>
|
||||
|
||||
The appframework app provides a simple baseclass for adding controllers. Controllers connect your view (templates) with your database. Controllers themselves are connected to one or more routes. Controllers go into the :file:`controller` directory.
|
||||
The appframework app provides a simple baseclass for adding controllers: :php:class:`OCA\\AppFramework\\Controller\\Controller`. Controllers connect your view (templates) with your database. Controllers themselves are connected to one or more routes. Controllers go into the :file:`controller` directory.
|
||||
|
||||
A controller should be created for each resource. Think of it as an URL scheme::
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ A simple route would look like this:
|
||||
);
|
||||
|
||||
|
||||
:php:class:`OCA\\AppFramework\\App`
|
||||
|
||||
The first argument is the name of your route. This is used as an identifier to get the URL of the route and is a nice way to generate the URL in your templates or JavaScript for certain links since it does not force you to hardcode your URLs. To use it in OC templates, use:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
Reference in New Issue
Block a user