-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from matks/split-module-1
Copy demoextendsymfonyform1 into demoextendsymfonyform3
- Loading branch information
Showing
20 changed files
with
1,107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
vendor/ | ||
composer.lock | ||
.idea | ||
js/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Demonstration of how to use CQRS in a module | ||
|
||
## About | ||
|
||
This module adds a new field to Customer: a yes/no field "is allowed to review". | ||
This new field appears: | ||
- in the Customers listing as a new column | ||
- in the Customers Add/Edit form as a new field you can manage | ||
|
||
This modules demonstrates | ||
- how to add this field, manage its content and its | ||
properties using modern hooks in Symfony pages | ||
- how to use custom [CQRS](https://devdocs.prestashop.com/1.7/development/architecture/domain/cqrs/) Commands and Queries to separate your domain from your application | ||
- how to use Translator inside modern Symfony module | ||
|
||
*This part is demonstrated as a possibility for your module, this is | ||
not mandatory to be done this way. | ||
|
||
### Supported PrestaShop versions | ||
|
||
This module is compatible with and 1.7.6.0 and above versions. | ||
|
||
### Requirements | ||
|
||
1. Composer, see [Composer](https://getcomposer.org/) to learn more | ||
|
||
### How to install | ||
|
||
1. Download or clone module into `modules` directory of your PrestaShop installation | ||
2. Rename the directory to make sure that module directory is named `demoextendsymfonyform3`* | ||
3. `cd` into module's directory and run following commands: | ||
- `composer install` - to download dependencies into vendor folder | ||
4. Install module from Back Office | ||
|
||
*Because the name of the directory and the name of the main module file must match. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "prestashop/demoextendsymfonyform3", | ||
"description": "Help developers to understand how to create module using new hooks and apply best practices when using CQRS", | ||
"autoload": { | ||
"psr-4": { | ||
"DemoCQRSHooksUsage\\": "src/" | ||
} | ||
}, | ||
"license": "MIT", | ||
"type": "prestashop-module" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# @see https://devdocs.prestashop.com/1.7/modules/concepts/controllers/admin-controllers/#how-to-map-an-action-of-your-controller-to-a-uri | ||
ps_democqrshooksusage_toggle_is_allowed_for_review: | ||
path: demo-cqrs-hook-usage/{customerId}/toggle-is-allowed-for-review | ||
methods: [POST] | ||
defaults: | ||
_controller: 'DemoCQRSHooksUsage\Controller\Admin\CustomerReviewController::toggleIsAllowedForReviewAction' | ||
requirements: | ||
customerId: \d+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
services: | ||
_defaults: | ||
public: true | ||
# @see https://devdocs.prestashop.com/1.7/development/architecture/migration-guide/forms/cqrs-usage-in-forms/ for CQRS pattern usage examples. | ||
democqrshooksusage.domain.reviewer.command_handler.toggle_is_allowed_to_review_handler: | ||
class: 'DemoCQRSHooksUsage\Domain\Reviewer\CommandHandler\ToggleIsAllowedToReviewHandler' | ||
arguments: | ||
- '@democqrshooksusage.repository.reviewer' | ||
tags: | ||
- name: tactician.handler | ||
command: 'DemoCQRSHooksUsage\Domain\Reviewer\Command\ToggleIsAllowedToReviewCommand' | ||
|
||
democqrshooksusage.domain.reviewer.query_handler.get_reviewer_settings_for_form_handler: | ||
class: 'DemoCQRSHooksUsage\Domain\Reviewer\QueryHandler\GetReviewerSettingsForFormHandler' | ||
arguments: | ||
- '@democqrshooksusage.repository.reviewer' | ||
tags: | ||
- name: tactician.handler | ||
command: 'DemoCQRSHooksUsage\Domain\Reviewer\Query\GetReviewerSettingsForForm' | ||
|
||
democqrshooksusage.domain.reviewer.command_handler.update_is_allowed_to_review_handler: | ||
class: 'DemoCQRSHooksUsage\Domain\Reviewer\CommandHandler\UpdateIsAllowedToReviewHandler' | ||
arguments: | ||
- '@democqrshooksusage.repository.reviewer' | ||
tags: | ||
- name: tactician.handler | ||
command: 'DemoCQRSHooksUsage\Domain\Reviewer\Command\UpdateIsAllowedToReviewCommand' | ||
|
||
democqrshooksusage.repository.reviewer: | ||
class: 'DemoCQRSHooksUsage\Repository\ReviewerRepository' | ||
arguments: | ||
- '@doctrine.dbal.default_connection' | ||
- '%database_prefix%' |
Oops, something went wrong.