mirror of
https://github.com/Karaka-Management/Developer-Guide.git
synced 2026-01-12 21:08:40 +00:00
update
This commit is contained in:
parent
26a901d01f
commit
2ac6ea9110
|
|
@ -212,7 +212,7 @@ use app\view\TestView;
|
|||
|
||||
class TestController
|
||||
{
|
||||
private ApplicationAbstract $app = null;
|
||||
private ApplicationAbstract $app;
|
||||
|
||||
/* the dispatcher passes the ApplicationAbstract reference to the controller */
|
||||
public function __construct(ApplicationAbstract $app)
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@ $dispatcher->dispatch(function($para1, $para2) { ... }, $staticToCallPara1, $sta
|
|||
The dispatcher accepts the resoults from the `route()` method of the router which is an array of routes.
|
||||
|
||||
```php
|
||||
$dispatcher->dispatch($router->route($request))
|
||||
$dispatcher->dispatch($router->route($request->getUri()->getRoute()));
|
||||
```
|
||||
|
||||
Based on the function definition returned by the router it's possible to pass more parameters to the function such e.g. request and response objects.
|
||||
|
||||
```php
|
||||
$dispatcher->dispatch($router->route($request), $request, $response)
|
||||
$dispatcher->dispatch($router->route($request->getUri()->getRoute()), $request, $response);
|
||||
```
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ The following directory structure should roughly visualize how modules are struc
|
|||
* {UniqueModuleName}
|
||||
* Admin
|
||||
* Install
|
||||
* db.json
|
||||
* Navigation.install.json
|
||||
* Navigation.php
|
||||
* Routes
|
||||
|
|
@ -51,6 +52,83 @@ The content of the navigation install file highly depends on the module and shou
|
|||
Some modules can be used without requiring any additional installations it all depends on how the other modules got implemented. Thats also why many modules don't offer any integration at all and
|
||||
are almost stand-alone without the possibility to get extended.
|
||||
|
||||
### Database schema
|
||||
|
||||
The database schema of a module is defined in the `db.json` file and is automatically installed during the installation process.
|
||||
|
||||
In the following you can find a sample `db.json` file.
|
||||
|
||||
```json
|
||||
{
|
||||
"task": {
|
||||
"name": "task",
|
||||
"fields": {
|
||||
"task_id": {
|
||||
"name": "task_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"task_title": {
|
||||
"name": "task_title",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": false
|
||||
},
|
||||
"task_desc": {
|
||||
"name": "task_desc",
|
||||
"type": "TEXT",
|
||||
"null": false
|
||||
},
|
||||
"task_type": {
|
||||
"name": "task_type",
|
||||
"type": "TINYINT",
|
||||
"null": false
|
||||
},
|
||||
"task_created_at": {
|
||||
"name": "task_created_at",
|
||||
"type": "DATETIME",
|
||||
"default": null,
|
||||
"null": true
|
||||
},
|
||||
"task_created_by": {
|
||||
"name": "task_created_by",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "account",
|
||||
"foreignKey": "account_id"
|
||||
}
|
||||
}
|
||||
},
|
||||
"task_media": {
|
||||
"name": "task_media",
|
||||
"fields": {
|
||||
"task_media_id": {
|
||||
"name": "task_media_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"task_media_src": {
|
||||
"name": "task_media_src",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "task",
|
||||
"foreignKey": "task_id"
|
||||
},
|
||||
"task_media_dst": {
|
||||
"name": "task_media_dst",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "media",
|
||||
"foreignKey": "media_id"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Installer.php
|
||||
|
||||
In contrast to the install file for other modules this file has to follow more strict standards. The following example shows you the bare minimum requirements of a installation file:
|
||||
|
|
|
|||
|
|
@ -34,7 +34,32 @@ In the files directory all files are stored.
|
|||
The `package.json` file contains information of the package.
|
||||
|
||||
```json
|
||||
|
||||
{
|
||||
"name": "{MODULE_NAME|RESOURCE_NAME|phpOMS|jsOMS|cssOMS}",
|
||||
"type": "Modules",
|
||||
"version": "1.0.1",
|
||||
"update": [
|
||||
{
|
||||
"download": {
|
||||
"{download_uri}": "{save_to_path/file_name}"
|
||||
},
|
||||
"move": {
|
||||
"{file_or_directory_to_move}": "{new_destination}"
|
||||
},
|
||||
"copy": {
|
||||
"{file_or_directory_to_copy}": [
|
||||
"{new_destination}"
|
||||
]
|
||||
},
|
||||
"delete": [
|
||||
"{file_or_directory_to_delete}"
|
||||
],
|
||||
"cmd": [
|
||||
"{php|sh|batch_script_to_execute}",
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Other
|
||||
|
|
|
|||
|
|
@ -113,4 +113,38 @@ $query->prefix(...)->select(...)->from(...)->where(...)->groupBy('columnA', 'col
|
|||
|
||||
### Schema Builder
|
||||
|
||||
The schema builder is used for schema related operations such as `DROP`, `CREATE` etc.
|
||||
The schema builder is used for schema related operations such as `DROP`, `CREATE` etc.
|
||||
|
||||
#### Drop Database
|
||||
|
||||
A database can be dropped with `dropDatabase`.
|
||||
|
||||
```php
|
||||
$query->dropDatabase('test');
|
||||
```
|
||||
|
||||
#### Create Table
|
||||
|
||||
A table can be created with `createTable`.
|
||||
|
||||
```php
|
||||
$query->createTable('user_roles')
|
||||
->field('user_id', 'INT', null, false, true, true, 'users', 'ext1_id')
|
||||
->field('role_id', 'VARCHAR(10)', '1', true, false, false, 'roles', 'ext2_id');
|
||||
```
|
||||
|
||||
#### Show Tables
|
||||
|
||||
All tables of a database can be returned with `selectTables`.
|
||||
|
||||
```php
|
||||
$query->selectTables();
|
||||
```
|
||||
|
||||
#### Show Table Fields
|
||||
|
||||
All table fields of a table can be returned with `selectFields`.
|
||||
|
||||
```php
|
||||
$query->selectFields('test');
|
||||
```
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Installing the application as a developer can be achived by following one of the
|
|||
|
||||
## Server Requirements
|
||||
|
||||
* PHP >= 7.2
|
||||
* PHP >= 7.4
|
||||
* PDO PHP Extension
|
||||
* mbstring
|
||||
* database such as mysql
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ The javascript documentation is based on JsDoc, therefore only valid JsDoc comme
|
|||
|
||||
```js
|
||||
/**
|
||||
* File description
|
||||
* File description.
|
||||
*
|
||||
* @package Package name
|
||||
* @copyright Orange Management
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user