Skip to content

Commit

Permalink
doc controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
jcheron committed Oct 18, 2017
1 parent 0e02ed5 commit ce273a3
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
36 changes: 36 additions & 0 deletions docs/controller/controllers.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,38 @@
Ubiquity Controllers
====================
A controller is a PHP class inheriting from `micro\controllers\Controller`, providing an entry point in the application.
Controllers and their methods define accessible URLs.

Controller creation
-------------------
The easiest way to create a controller is to do it from the devtools.

From the command prompt, go to the project folder.
To create the Products controller, use the command:
::
Micro controller Products

The Products.php controller is created in the `app/controllers` folder of the project.

::
<?php
namespace controllers;
/**
* Controller Products
**/
class Products extends ControllerBase{
public function index(){}
}

It is now possible to access URLs (the `index` method is solicited by default):
::
example.com/Products
example.com/Products/index

.. note:: A controller can be created manually. In this case, he must respect the following rules:
* The class must be in the `app/controllers` folder
* The name of the class must match the name of the php file
* It must inherit from `ControllerBase` and be defined in the namespace `controllers`
* It must override the abstract `index` method
17 changes: 17 additions & 0 deletions docs/devtools.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Devtools usage
==============

Project creation
----------------

Controller creation
-------------------

Model creation
--------------

All models creation
-------------------

Cache initialization
--------------------
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Installation
* :doc:`install`
* :doc:`createproject`
* :doc:`confproject`
* :doc:`devtools`

Controller
----------
Expand Down

0 comments on commit ce273a3

Please sign in to comment.