Skip to content

Commit

Permalink
Merge branch '1.1'
Browse files Browse the repository at this point in the history
* 1.1:
  Fixed Customer API docs with invalid "groups" parameter
  Improve customizing factory docs
  • Loading branch information
pamil committed Mar 9, 2018
2 parents ff17823 + 38abff0 commit fcc55ad
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
16 changes: 6 additions & 10 deletions docs/api/customers.rst
Expand Up @@ -53,7 +53,7 @@ If you request for a more detailed data, you will receive an object with followi
+-------------------------+-------------------------------------------+
| birthday | Customers birthday |
+-------------------------+-------------------------------------------+
| groups | Array of groups customer belongs to |
| group | Customer group code |
+-------------------------+-------------------------------------------+

.. note::
Expand Down Expand Up @@ -81,7 +81,7 @@ Definition
+--------------------------+----------------+------------------------------------------------------------------------------------------------------+
| lastName | request | Customer's last name |
+--------------------------+----------------+------------------------------------------------------------------------------------------------------+
| groups | request | *(optional)* Array of groups customer belongs to |
| group | request | *(optional)* Customer group code |
+--------------------------+----------------+------------------------------------------------------------------------------------------------------+
| gender | request | Customer's gender |
+--------------------------+----------------+------------------------------------------------------------------------------------------------------+
Expand Down Expand Up @@ -139,9 +139,7 @@ Exemplary Response
"firstName":"John",
"lastName":"Diggle",
"gender":"m",
"group":[
]
"group":{}
}
If you try to create a customer without email or gender, you will receive a ``400 Bad Request`` error.
Expand Down Expand Up @@ -244,9 +242,7 @@ Exemplary Response
"firstName":"Levi",
"lastName":"Friesen",
"gender":"u",
"group":[
]
"group":{}
}
Collection of Customers
Expand Down Expand Up @@ -428,7 +424,7 @@ Definition
+--------------------------+----------------+------------------------------------------------------------------------------+
| lastName | request | Customers last name |
+--------------------------+----------------+------------------------------------------------------------------------------+
| groups | request | *(optional)* Array of groups customer belongs to |
| group | request | *(optional)* Customer group code |
+--------------------------+----------------+------------------------------------------------------------------------------+
| gender | request | Customers gender |
+--------------------------+----------------+------------------------------------------------------------------------------+
Expand Down Expand Up @@ -534,7 +530,7 @@ Definition
+--------------------------+----------------+--------------------------------------------------+
| lastName | request | *(optional)* Customers last name |
+--------------------------+----------------+--------------------------------------------------+
| groups | request | *(optional)* Array of groups customer belongs to |
| group | request | *(optional)* Customer group code |
+--------------------------+----------------+--------------------------------------------------+
| gender | request | *(optional)* Customers gender |
+--------------------------+----------------+--------------------------------------------------+
Expand Down
22 changes: 20 additions & 2 deletions docs/customization/factory.rst
Expand Up @@ -81,7 +81,7 @@ Take its interface (``Sylius\Component\Product\Factory\ProductFactoryInterface``
public function createDisabled(): ProductInterface
{
/** @var ProductInterface $product */
$product = $this->decoratedFactory->createNew();
$product = $this->decoratedFactory->createWithVariant();
$product->setEnabled(false);
Expand All @@ -104,10 +104,11 @@ as a decorating service in the ``app/Resources/config/services.yml``.
**3.** You can use the new method of the factory in routing.

After the ``sylius.factory.product`` has been decorated it has got the new ``createDisabled()`` method.
You can for example override ``sylius_admin_product_create_simple`` route like below:
To actually use it overwrite ``sylius_admin_product_create_simple`` route like below in ``app/config/routing/admin/product.yml``:

.. code-block:: yaml
# app/config/routing/admin/product.yml
sylius_admin_product_create_simple:
path: /products/new/simple
methods: [GET, POST]
Expand All @@ -126,6 +127,23 @@ You can for example override ``sylius_admin_product_create_simple`` route like b
route:
name: sylius_admin_product_create_simple
Create a new yaml file located at ``app/config/routing/admin.yml``, if it does not exist yet.

.. code-block:: yaml
# app/config/routing/admin.yml
app_admin_product:
resource: 'admin/product.yml'
                       
Remember to import the ``app/config/routing/admin.yml`` into the ``app/config/routing.yml``.

.. code-block:: yaml
# app/config/routing.yml
app_admin:
resource: 'routing/admin.yml'
prefix: /admin
.. include:: /customization/plugins.rst.inc

Learn more
Expand Down

0 comments on commit fcc55ad

Please sign in to comment.