-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy demoextendsymfonyform1 into demoextendsymfonyform3 #33
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
|
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.