Devtools usage¶
Project creation¶
See Project creation to create a project.
Tip
For all other commands, you must be in your project folder or one of its subfolders.
Important
The .ubiquity folder created automatically with the project allows the devtools to find the root folder of the project.
If it has been deleted or is no longer present, you must recreate this empty folder.
Controller creation¶
Specifications¶
- command :
controller - Argument :
controller-name - aliases :
create-controller
Parameters¶
| short name | name | role | default | Allowed values |
|---|---|---|---|---|
| v | view | Creates the associated view index. | true | true, false |
Samples:¶
Creates the controller controllers\ClientController class in app/controllers/ClientController.php:
Ubiquity controller ClientController
Creates the controller controllers\ClientController class in app/controllers/ClientController.php and the associated view in app/views/ClientController/index.html:
Ubiquity controller ClientController -v
Action creation¶
Specifications¶
- command :
action - Argument :
controller-name.action-name - aliases :
new-action
Parameters¶
| short name | name | role | default | Allowed values |
|---|---|---|---|---|
| p | params | The action parameters (or arguments). | a,b=5 or $a,$b,$c | |
| r | route | The associated route path. | /path/to/route | |
| v | create-view | Creates the associated view. | false | true,false |
Samples:¶
Adds the action all in controller Users:
Ubiquity action Users.all
code result:
1 2 3 4 5 6 7 8 9 10 11 12 13 | namespace controllers;
/**
* Controller Users
*/
class Users extends ControllerBase{
public function index(){}
public function all(){
}
}
|
Adds the action display in controller Users with a parameter:
Ubiquity action Users.display -p=idUser
code result:
1 2 3 4 5 6 7 8 | class Users extends ControllerBase{
public function index(){}
public function display($idUser){
}
}
|
Adds the action display with an associated route:
Ubiquity action Users.display -p=idUser -r=/users/display/{idUser}
code result:
1 2 3 4 5 6 7 8 9 10 11 12 13 | namespace controllers;
use Ubiquity\attributes\items\router\Route;
class Users extends ControllerBase{
public function index(){}
#[Route('/users/display/{idUser}')]
public function display($idUser){
}
}
|
1 2 3 4 5 6 7 8 9 10 11 12 13 | namespace controllers;
class Users extends ControllerBase{
public function index(){}
/**
*@route("/users/display/{idUser}")
*/
public function display($idUser){
}
}
|
Adds the action search with multiple parameters:
Ubiquity action Users.search -p=name,address=''
code result:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | namespace controllers;
use Ubiquity\attributes\items\router\Route;
class Users extends ControllerBase{
public function index(){}
#[Route('/users/display/{idUser}')]
public function display($idUser){
}
public function search($name,$address=''){
}
}
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | namespace controllers;
class Users extends ControllerBase{
public function index(){}
/**
* @route("/users/display/{idUser}")
*/
public function display($idUser){
}
public function search($name,$address=''){
}
}
|
Adds the action search and creates the associated view:
Ubiquity action Users.search -p=name,address -v
Model creation¶
Note
Optionally check the database connection settings in the app/config/config.php file before running these commands.
To generate a model corresponding to the user table in database:
Ubiquity model user
Cache initialization¶
To initialize the cache for routing (based on annotations in controllers) and orm (based on annotations in models) :
Ubiquity init-cache