Skip to content

Commit

Permalink
Merge branch '1.2'
Browse files Browse the repository at this point in the history
* 1.2:
  Require Symfony 4.1.1 and remove hotfixes for 4.1.0
  Php Inspections (EA Ultimate): minor code tweaks
  [Admin] Add missing form parameter to sonata form events
  Add label for issues/pr's that should not be staled
  [Doc] Fix typos
  • Loading branch information
pamil committed Jul 2, 2018
2 parents 60134b7 + cceb49e commit d87b58a
Show file tree
Hide file tree
Showing 69 changed files with 180 additions and 230 deletions.
1 change: 1 addition & 0 deletions .github/stale.yml
Expand Up @@ -3,6 +3,7 @@ daysUntilClose: 7
exemptLabels:
- Bug
- Critical
- Do not stale
staleLabel: Stale
markComment: >
This issue has been automatically marked as stale because it has not had any
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -58,7 +58,7 @@
"symfony/polyfill-intl-icu": "^1.3",
"symfony/polyfill-mbstring": "^1.3",
"symfony/swiftmailer-bundle": "^3.0",
"symfony/symfony": "^3.4|^4.1",
"symfony/symfony": "^3.4|^4.1.1",
"symfony/thanks": "^1.0",
"twig/extensions": "^1.4",
"twig/twig": "^2.0",
Expand Down
2 changes: 1 addition & 1 deletion docs/book/customers/addresses/address_book.rst
Expand Up @@ -21,7 +21,7 @@ On the Customer entity we are holding a collection of addresses:
*/
protected $addresses;
We can operate on it as usually - by adding and removing objects.
We can operate on it as usual - by adding and removing objects.

Besides the Customer entity has a **default address** field that is the default address used both for shipping and billing,
the one that will be filling the form fields by default.
Expand Down
2 changes: 1 addition & 1 deletion docs/book/customers/customer_and_shopuser.rst
Expand Up @@ -17,7 +17,7 @@ or that have somehow provided us their e-mail.
How to create a Customer programmatically?
''''''''''''''''''''''''''''''''''''''''''

As usually, use a factory. The only required field for the Customer entity is ``email``, provide it before adding it to the repository.
As usual, use a factory. The only required field for the Customer entity is ``email``, provide it before adding it to the repository.

.. code-block:: php
Expand Down
2 changes: 1 addition & 1 deletion docs/book/orders/adjustments.rst
Expand Up @@ -26,7 +26,7 @@ How to create an Adjustment programmatically?

The Adjustments alone are a bit useless. They should be created alongside Orders.

As usually get a factory and create an adjustment.
As usual, get a factory and create an adjustment.
Then give it a ``type`` - you can find all the available types on the `AdjustmentInterface <https://github.com/Sylius/Sylius/blob/master/src/Sylius/Component/Core/Model/AdjustmentInterface.php>`_.
The adjustment needs also the ``amount`` - which is the amount of money that will be **added to the orders total**.

Expand Down
6 changes: 3 additions & 3 deletions docs/book/orders/coupons.rst
Expand Up @@ -61,12 +61,12 @@ Now create an PromotionAction that will take place after applying this promotion
$this->container->get('sylius.repository.promotion')->add($promotion);
Finally to see the effects of your promotion with couponyou need to **apply a coupon on the Order**.
Finally to see the effects of your promotion with coupon you need to **apply a coupon on the Order**.

How to apply a coupon to an Order?
----------------------------------

To apply you promotion with coupon that gives 100% discount on the shipping costs
To apply your promotion with coupon that gives 100% discount on the shipping costs
you need an order that has shipments. Set your promotion coupon on that order -
this is what happens when a customer provides a coupon code during checkout.

Expand All @@ -83,7 +83,7 @@ Promotion Coupon Generator

Making up new codes might become difficult if you would like to prepare a lot of coupons at once. That is why Sylius
provides a service that generates random codes for you - `CouponGenerator <https://github.com/Sylius/Sylius/blob/master/src/Sylius/Component/Promotion/Generator/PromotionCouponGenerator.php>`_.
In its **PromotionCouponGeneratorInstruction** you can define the amount of coupons that will be generated, length of their codes, expiration date and usage limit.
In its **PromotionCouponGeneratorInstruction** you can define the amount of coupons that will be generated, the length of their codes, expiration date and usage limit.

.. code-block:: php
Expand Down
2 changes: 1 addition & 1 deletion docs/book/orders/payments.rst
Expand Up @@ -81,7 +81,7 @@ Gateway is configured for each payment method separately using the payment metho
How to create a PaymentMethod programmatically?
'''''''''''''''''''''''''''''''''''''''''''''''

As usually, use a factory to create a new PaymentMethod and give it a unique code.
As usual, use a factory to create a new PaymentMethod and give it a unique code.

.. code-block:: php
Expand Down
2 changes: 1 addition & 1 deletion docs/book/orders/promotions.rst
Expand Up @@ -18,7 +18,7 @@ and **priority** that is useful for them, because the exclusive promotion should
How to create a Promotion programmatically?
-------------------------------------------

Just as usually, use a factory. The promotion needs a ``code`` and a ``name``.
Just as usual, use a factory. The promotion needs a ``code`` and a ``name``.

.. code-block:: php
Expand Down
10 changes: 5 additions & 5 deletions docs/book/orders/shipments.rst
Expand Up @@ -4,7 +4,7 @@
Shipments
=========

A **Shipment** is a representation of a shipping request for an Order. Sylius supports multiple shipments per one Order.
A **Shipment** is a representation of a shipping request for an Order. Sylius can attach multiple shipments to each single Order.

How is a Shipment created for an Order?
'''''''''''''''''''''''''''''''''''''''
Expand All @@ -16,7 +16,7 @@ How is a Shipment created for an Order?
The Shipment State Machine
--------------------------

A Shipment that is attached to an Order will have its own state machine with such states available:
A Shipment that is attached to an Order will have its own state machine with the following states available:
``cart``, ``ready``, ``cancelled``, ``shipped``.

The allowed transitions between these states are:
Expand Down Expand Up @@ -46,8 +46,8 @@ Shipping Methods
How to create a ShippingMethod programmatically?
''''''''''''''''''''''''''''''''''''''''''''''''

As usually use a factory to create a new ShippingMethod. Give it a ``code``, set a desired shipping calculator and set a ``zone``.
It need also a configuration, for instance of the amount (cost).
As usual use a factory to create a new ShippingMethod. Give it a ``code``, set a desired shipping calculator and set a ``zone``.
It also need a configuration, for instance of the amount (cost).
At the end add it to the system using a repository.

.. code-block:: php
Expand Down Expand Up @@ -110,7 +110,7 @@ The already defined calculators in Sylius are described as constants in the
ProductVariant Configuration
----------------------------

In order to be able to calculate shipping costs basing on the volume and weight of products in an order
In order to be able to calculate shipping costs based on the volume and weight of products in an order
the ProductVariant has the ``depth``, ``width``, ``height`` and ``weight`` fields.

Shipment complete events
Expand Down
4 changes: 2 additions & 2 deletions docs/book/products/inventory.rst
Expand Up @@ -12,7 +12,7 @@ InventoryUnit
InventoryUnit has a relation to a `Stockable <https://github.com/Sylius/Sylius/blob/master/src/Sylius/Component/Inventory/Model/StockableInterface.php>`_ on it,
in case of Sylius Core it will be a relation to the **ProductVariant** that implements the StockableInterface on the **OrderItemUnit** that implements the InventoryUnitInterface.

It represents a physical unit of the product variant that is in the magazine.
It represents a physical unit of the product variant that is in the shop.

Inventory On Hold
-----------------
Expand All @@ -27,7 +27,7 @@ Putting inventory items ``onHold`` is a way of reserving them before the custome
Availability Checker
--------------------

There is a service that will help you checking the availability of items in the inventory
There is a service that will help you check the availability of items in the inventory
- `AvailabilityChecker <https://github.com/Sylius/Sylius/blob/master/src/Sylius/Component/Inventory/Checker/AvailabilityChecker.php>`_.

It has two methods ``isStockAvailable`` (is there at least one item available) and ``isStockSufficient`` (is there a given amount of items available).
Expand Down
2 changes: 1 addition & 1 deletion docs/book/products/pricing.rst
Expand Up @@ -28,7 +28,7 @@ Each currency defined in the system should have an ExchangeRate configured.

**ExchangeRate** is a separate entity that holds a relation between two currencies and specifies their exchange rate.

Exchange rates are used for viewing the *approximate* price in a currency different form the base currency of a channel.
Exchange rates are used for viewing the *approximate* price in a currency different from the base currency of a channel.

Learn more
----------
Expand Down
6 changes: 3 additions & 3 deletions docs/book/products/search.rst
Expand Up @@ -4,13 +4,13 @@
Search
======

Having a products search functionality in an eCommerce system is a very popular usecase.
Having a products search functionality in an eCommerce system is a very popular use case.
Sylius provides a products search functionality that is a grid filter.

Grid filters
------------

For simple usecases of products search use the **filters of grids**.
For simple use cases of products search use the **filters of grids**.
For example, the shop's categories each have a ``search`` filter in the products grid:

.. code-block:: yaml
Expand All @@ -25,7 +25,7 @@ For example, the shop's categories each have a ``search`` filter in the products
form_options:
type: contains
It searches by product names that contain a string that the user typed in the search bar.
It searches by product names that contains a string that the user typed in the search bar.

The search bar looks like below:

Expand Down
8 changes: 4 additions & 4 deletions docs/book/products/taxons.rst
Expand Up @@ -5,7 +5,7 @@ Taxons
======

We understand Taxons in Sylius as you would normally define categories.
Sylius gives you a possibility to categorize your products in a very flexible way, which is one of the most vital funtionalities
Sylius gives you a possibility to categorize your products in a very flexible way, which is one of the most vital functionalities
of the modern e-commerce systems.
The Taxons system in Sylius works in a hierarchical way.
Let's see exemplary categories trees:
Expand Down Expand Up @@ -107,10 +107,10 @@ In order to categorize products you will need to assign your taxons to them - vi
What is the mainTaxon of a Product?
-----------------------------------

The product entity in Sylius core has a field ``mainTaxon``. On its basis for instance the breadcrumbs are generated.
But also you can use it for your own logic, like for instance links generation.
The product entity in Sylius core has a field ``mainTaxon``. This field is used, for instance, for breadcrumbs generation.
But you can also use it for your own logic, like for instance links generation.

To have it on your product you need to use the ``setMainTaxon()`` method.
To set it on your product you need to use the ``setMainTaxon()`` method.

Learn more
----------
Expand Down
Expand Up @@ -85,9 +85,7 @@ public function iShouldSeeTheProductVariantNamedAnd(...$names)
*/
public function iShouldSeeTheProductVariantLabeledAs($label)
{
$itemsLabels = array_map(function ($item) {
return $item['descriptor'];
}, $this->getJSONResponse());
$itemsLabels = array_column($this->getJSONResponse(), 'descriptor');

Assert::oneOf($label, $itemsLabels, 'Expected "%s" to be on the list, found: %s.');
}
Expand Down
4 changes: 1 addition & 3 deletions src/Sylius/Behat/Context/Api/Admin/ManagingTaxonsContext.php
Expand Up @@ -97,9 +97,7 @@ public function iShouldSeeTaxonsInTheList($number)
public function iShouldSeeTheTaxonNamedAnd(...$expectedTaxonNames)
{
$response = json_decode($this->client->getResponse()->getContent(), true);
$taxonNames = array_map(function ($item) {
return $item['name'];
}, $response);
$taxonNames = array_column($response, 'name');

Assert::allOneOf($taxonNames, $expectedTaxonNames);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Sylius/Behat/Context/Setup/ProductContext.php
Expand Up @@ -342,7 +342,7 @@ public function theProductHasVariantPricedAt(
$productVariantName,
$price,
StringInflector::nameToUppercaseCode($productVariantName),
(null !== $channel) ? $channel : $this->sharedStorage->get('channel')
$channel ?? $this->sharedStorage->get('channel')
);
}

Expand Down
Expand Up @@ -848,7 +848,7 @@ public function iShouldNotSeeInformationAboutShipments()
*/
private function assertElementValidationMessage($type, $element, $expectedMessage)
{
$element = sprintf('%s_%s', $type, implode('_', explode(' ', $element)));
$element = sprintf('%s_%s', $type, str_replace(' ', '_', $element));
Assert::true($this->updatePage->checkValidationMessageFor($element, $expectedMessage));
}
}
Expand Up @@ -412,7 +412,7 @@ private function createDefaultAddress()
*/
private function assertElementValidationMessage($type, $element, $expectedMessage)
{
$element = sprintf('%s_%s', $type, implode('_', explode(' ', $element)));
$element = sprintf('%s_%s', $type, str_replace(' ', '_', $element));
Assert::true($this->addressPage->checkValidationMessageFor($element, $expectedMessage));
}
}
2 changes: 1 addition & 1 deletion src/Sylius/Behat/Page/Admin/Channel/UpdatePage.php
Expand Up @@ -75,7 +75,7 @@ public function isCurrencyChosen($currencyCode)
*/
public function chooseDefaultTaxZone($taxZone)
{
$this->getDocument()->selectFieldOption('Default tax zone', (null === $taxZone) ? '' : $taxZone);
$this->getDocument()->selectFieldOption('Default tax zone', $taxZone ?? '');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Sylius/Behat/Page/Admin/Order/UpdatePage.php
Expand Up @@ -113,7 +113,7 @@ private function specifyElementValue($elementName, $value)
*/
private function chooseCountry($country, $addressType)
{
$this->getElement($addressType . '_country')->selectOption((null !== $country) ? $country : 'Select');
$this->getElement($addressType . '_country')->selectOption($country ?? 'Select');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Sylius/Behat/Page/SymfonyPage.php
Expand Up @@ -60,7 +60,7 @@ protected function getUrl(array $urlParameters = [])
$replace[sprintf('?%s=%s', $key, $value)] = '';
}

$path = str_replace(array_keys($replace), array_values($replace), $path);
$path = str_replace(array_keys($replace), $replace, $path);

return $this->makePathAbsolute($path);
}
Expand Down
10 changes: 5 additions & 5 deletions src/Sylius/Bundle/AddressingBundle/composer.json
Expand Up @@ -25,16 +25,16 @@
"stof/doctrine-extensions-bundle": "^1.2",
"sylius/addressing": "^1.2",
"sylius/resource-bundle": "^1.2",
"symfony/framework-bundle": "^3.4|^4.1"
"symfony/framework-bundle": "^3.4|^4.1.1"
},
"require-dev": {
"doctrine/orm": "^2.5",
"phpspec/phpspec": "^4.0",
"symfony/dependency-injection": "^3.4|^4.1",
"symfony/form": "^3.4|^4.1",
"symfony/validator": "^3.4|^4.1",
"symfony/dependency-injection": "^3.4|^4.1.1",
"symfony/form": "^3.4|^4.1.1",
"symfony/validator": "^3.4|^4.1.1",
"phpunit/phpunit": "^6.5",
"symfony/browser-kit": "^3.4|^4.1",
"symfony/browser-kit": "^3.4|^4.1.1",
"polishsymfonycommunity/symfony-mocker-container": "^1.0"
},
"conflict": {
Expand Down
8 changes: 4 additions & 4 deletions src/Sylius/Bundle/AdminApiBundle/composer.json
Expand Up @@ -24,15 +24,15 @@

"friendsofsymfony/oauth-server-bundle": "^1.6",
"sylius/core-bundle": "^1.2",
"symfony/form": "^3.4|^4.1",
"symfony/framework-bundle": "^3.4|^4.1",
"symfony/validator": "^3.4|^4.1"
"symfony/form": "^3.4|^4.1.1",
"symfony/framework-bundle": "^3.4|^4.1.1",
"symfony/validator": "^3.4|^4.1.1"
},
"require-dev": {
"doctrine/orm": "^2.5",
"phpspec/phpspec": "^4.0",
"phpunit/phpunit": "^6.5",
"symfony/dependency-injection": "^3.4|^4.1",
"symfony/dependency-injection": "^3.4|^4.1.1",
"twig/twig": "^2.0"
},
"config": {
Expand Down
Expand Up @@ -97,8 +97,6 @@ sylius_admin_product_variant_delete:
arguments:
id: $id
productId: $productId
requirements:
id: '\d+' # Hotfix for https://github.com/symfony/symfony/issues/27512, will be removed after Symfony ^4.1.1 is required.

sylius_admin_product_variant_generate:
path: /generate
Expand Down
Expand Up @@ -102,5 +102,3 @@ sylius_admin_promotion_coupon_delete:
section: admin
redirect: referer
permission: true
requirements:
id: '\d+' # Hotfix for https://github.com/symfony/symfony/issues/27512, will be removed after Symfony ^4.1.1 is required.
Expand Up @@ -6,7 +6,7 @@
{{ form_widget(form) }}
{% endif %}

{{ sonata_block_render_event(event_prefix ~ '.form', {'resource': resource}) }}
{{ sonata_block_render_event(event_prefix ~ '.form', {'resource': resource, 'form': form}) }}

{% include '@SyliusUi/Form/Buttons/_create.html.twig' with {'paths': {'cancel': path(configuration.getRouteName('index'), configuration.vars.route.parameters|default({}))}} %}

Expand Down
Expand Up @@ -7,7 +7,7 @@
{{ form_widget(form) }}
{% endif %}

{{ sonata_block_render_event(event_prefix ~ '.form', {'resource': resource}) }}
{{ sonata_block_render_event(event_prefix ~ '.form', {'resource': resource, 'form': form}) }}

{% include '@SyliusUi/Form/Buttons/_update.html.twig' with {'paths': {'cancel': path(configuration.getRouteName('index'), configuration.vars.route.parameters|default({}))}} %}
{{ form_row(form._token) }}
Expand Down
4 changes: 2 additions & 2 deletions src/Sylius/Bundle/AdminBundle/composer.json
Expand Up @@ -25,12 +25,12 @@
"sonata-project/intl-bundle": "^2.2",
"sylius/core-bundle": "^1.2",
"sylius/ui-bundle": "^1.2",
"symfony/framework-bundle": "^3.4|^4.1"
"symfony/framework-bundle": "^3.4|^4.1.1"
},
"require-dev": {
"phpspec/phpspec": "^4.0",
"phpunit/phpunit": "^6.5",
"symfony/dependency-injection": "^3.4|^4.1"
"symfony/dependency-injection": "^3.4|^4.1.1"
},
"conflict": {
"twig/twig": "^1.0"
Expand Down
8 changes: 4 additions & 4 deletions src/Sylius/Bundle/AttributeBundle/composer.json
Expand Up @@ -27,15 +27,15 @@
"stof/doctrine-extensions-bundle": "^1.2",
"sylius/attribute": "^1.2",
"sylius/resource-bundle": "^1.2",
"symfony/framework-bundle": "^3.4|^4.1"
"symfony/framework-bundle": "^3.4|^4.1.1"
},
"require-dev": {
"doctrine/orm": "^2.5",
"phpspec/phpspec": "^4.0",
"phpunit/phpunit": "^6.5",
"symfony/dependency-injection": "^3.4|^4.1",
"symfony/form": "^3.4|^4.1",
"symfony/browser-kit": "^3.4|^4.1",
"symfony/dependency-injection": "^3.4|^4.1.1",
"symfony/form": "^3.4|^4.1.1",
"symfony/browser-kit": "^3.4|^4.1.1",
"polishsymfonycommunity/symfony-mocker-container": "^1.0"
},
"config": {
Expand Down

0 comments on commit d87b58a

Please sign in to comment.