Skip to content

Commit

Permalink
Merge branch '1.2'
Browse files Browse the repository at this point in the history
* 1.2:
  [Translations] Updated translations from Crowdin
  [Translations] Updated translations from Crowdin
  [Documentation] Updated link to Payum docs
  Document "event" option in resource routing
  [Documentation] Fix deprecated link to repository
  Fixed typo in PayumController
  • Loading branch information
pamil committed Jun 11, 2018
2 parents c7d6185 + cc3d6cd commit 4d3b109
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/book/orders/payments.rst
Expand Up @@ -167,4 +167,4 @@ Learn more
----------

* :doc:`Payment - Component Documentation </components_and_bundles/components/Payment/index>`
* `Payum - Project Documentation <https://github.com/Payum/Payum/blob/master/src/Payum/Core/Resources/docs/index.md>`_
* `Payum - Project Documentation <https://github.com/Payum/Payum/blob/master/docs/index.md>`_
Expand Up @@ -202,6 +202,28 @@ In addition to the request parameters, you can access some of the newly created
With this configuration, the ``title`` parameter for route ``app_book_show`` will be obtained from your newly created book.

Custom Event Name
-----------------

By default, there are two events dispatched during resource creation, one before adding it do database, the other after successful addition.
The pattern is always the same - ``{applicationName}.{resourceName}.pre/post_create``. However, you can customize the last part of the event, to provide your
own action name.

.. code-block:: yaml
# app/config/routing.yml
app_book_customer_create:
path: /customer/books/new
methods: [GET, POST]
defaults:
_controller: app.controller.book:createAction
_sylius:
event: customer_create
This way, you can listen to ``app.book.pre_customer_create`` and ``app.book.post_customer_create`` events. It's especially useful, when you use
``ResourceController:createAction`` in more than one route.

Configuration Reference
-----------------------

Expand All @@ -217,6 +239,7 @@ Configuration Reference
_sylius:
template: Book/addToGenre.html.twig
form: app_new_book
event: book_create
factory:
method: createForGenre
arguments: [$genreName]
Expand Down
Expand Up @@ -72,6 +72,30 @@ By default the controller will redirect to the "index" route after successful ac
route: app_genre_show
parameters: { id: $genreId }
Custom Event Name
-----------------

By default, there are two events dispatched during resource deletion, one before removing, the other after successful removal.
The pattern is always the same - ``{applicationName}.{resourceName}.pre/post_delete``.
However, you can customize the last part of the event, to provide your own action name.

.. code-block:: yaml
# app/config/routing.yml
app_book_customer_delete:
path: /customer/book-delete/{id}
methods: [DELETE]
defaults:
_controller: app.controller.book:deleteAction
_sylius:
event: customer_delete
This way, you can listen to ``app.book.pre_customer_delete`` and ``app.book.post_customer_delete`` events. It's especially useful, when you use
``ResourceController:deleteAction`` in more than one route.


Configuration Reference
-----------------------

Expand All @@ -85,6 +109,7 @@ Configuration Reference
defaults:
_controller: app.controller.book:deleteAction
_sylius:
event: book_delete
repository:
method: findByGenreNameAndId
arguments: [$genreName, $id]
Expand Down
Expand Up @@ -137,6 +137,30 @@ You can also perform more complex redirects, with parameters. For example:
route: app_genre_show
parameters: { id: $genreId }
Custom Event Name
-----------------

By default, there are two events dispatched during resource update, one before setting new data, the other after successful update.
The pattern is always the same - ``{applicationName}.{resourceName}.pre/post_update``. However, you can customize the last part of the event, to provide your
own action name.

.. code-block:: yaml
# app/config/routing.yml
app_book_customer_update:
path: /customer/book-update/{id}
methods: [GET, PUT]
defaults:
_controller: app.controller.book:updateAction
_sylius:
event: customer_update
This way, you can listen to ``app.book.pre_customer_update`` and ``app.book.post_customer_update`` events. It's especially useful, when you use
``ResourceController:updateAction`` in more than one route.


[API] Returning resource or no content
--------------------------------------

Expand Down Expand Up @@ -176,6 +200,7 @@ Configuration Reference
_sylius:
template: Book/editInGenre.html.twig
form: app_book_custom
event: book_update
repository:
method: findBookByTitle
arguments: [$title, expr:service('app.context.book')]
Expand Down
6 changes: 3 additions & 3 deletions docs/contributing/code/patches.rst
Expand Up @@ -146,6 +146,9 @@ in mind the following:
* Never fix coding standards in some existing code as it makes the code review
more difficult (submit CS fixes as a separate patch);

* In addition to this "code" pull request, you must also update the documentation when appropriate.
See more in :doc:`contributing documentation </contributing/documentation/overview>` section.

* Write good commit messages (see the tip below).

.. tip::
Expand Down Expand Up @@ -309,9 +312,6 @@ your pull request is about adding a new feature or modifying an existing one,
explain the rationale for the changes. The pull request description helps the
code review.

In addition to this "code" pull request, you must also send a pull request to
the `documentation repository`_ to update the documentation when appropriate.

Rework your Patch
~~~~~~~~~~~~~~~~~

Expand Down
6 changes: 3 additions & 3 deletions src/Sylius/Bundle/PayumBundle/Controller/PayumController.php
Expand Up @@ -69,7 +69,7 @@ final class PayumController
private $getStatusRequestFactory;

/** @var ResolveNextRouteFactoryInterface */
private $resolveNextRouteRequestFacotry;
private $resolveNextRouteRequestFactory;

public function __construct(
Payum $payum,
Expand All @@ -88,7 +88,7 @@ public function __construct(
$this->viewHandler = $viewHandler;
$this->router = $router;
$this->getStatusRequestFactory = $getStatusFactory;
$this->resolveNextRouteRequestFacotry = $resolveNextRouteFactory;
$this->resolveNextRouteRequestFactory = $resolveNextRouteFactory;
}

public function prepareCaptureAction(Request $request, $tokenValue): Response
Expand Down Expand Up @@ -126,7 +126,7 @@ public function afterCaptureAction(Request $request): Response

$status = $this->getStatusRequestFactory->createNewWithModel($token);
$this->payum->getGateway($token->getGatewayName())->execute($status);
$resolveNextRoute = $this->resolveNextRouteRequestFacotry->createNewWithModel($status->getFirstModel());
$resolveNextRoute = $this->resolveNextRouteRequestFactory->createNewWithModel($status->getFirstModel());
$this->payum->getGateway($token->getGatewayName())->execute($resolveNextRoute);

$this->getHttpRequestVerifier()->invalidate($token);
Expand Down
Expand Up @@ -72,7 +72,6 @@ sylius:
channel: 'Kanal'
channels: 'Kanali'
checkbox: 'Potrdilno polje'
checkout: 'Plačilo'
choose_file: 'Izberite datoteko'
city: 'Mesto'
clear_cart: 'Spraznite košarico'
Expand Down Expand Up @@ -171,9 +170,7 @@ sylius:
details: 'Podrobnosti'
disable: 'Onemogoči'
display: 'Prikaz'
edit: 'Urejanje'
edit_association_type: 'Uredite vrsto združenja'
edit_locale: 'Urejanje področne nastavitve'
edit_my_address: 'Uredite svoj naslov'
edit_report: 'Uredi poročilo'
edit_your_personal_information: 'Uredite vaše osebne podatke'
Expand Down
Expand Up @@ -8,7 +8,6 @@ sylius:
enabled: Omogočeno
password:
label: Geslo
confirmation: Preverjanje
remember_me: Zapomni si me
shipping_address: Naslov za dostavo
username: Uporabniško ime
Expand Down

0 comments on commit 4d3b109

Please sign in to comment.