This guide contains instructions to upgrade from version v7.0.0-beta5 to v7.0.0-beta6.
Before you start, don't forget to take a look at general instructions about upgrading. There you can find links to upgrade notes for other versions too.
Note: instructions marked as "low priority" are not vital, however, we recommend to perform them as well during upgrading as it might ease your work in the future.
- (low priority) in your
docker/php-fpm/Dockerfile
change base image tophp:7.3-fpm-stretch
(#694) - add subnet of your Kubernetes cluster as ENV variable into the config
/project-base/kubernetes/deployments/smtp-server.yml
for the pod of smtp container (#777)
for instance:image: namshi/smtp:latest env: - name: RELAY_NETWORKS value: :192.168.0.0/16:10.0.0.0/8:172.16.0.0/12
- (low priority) add a new phing target
clean-redis
to yourbuild.xml
andbuild-dev.xml
and use it where you need to clean Redis cache. You can find an inspiration in #736<target name="clean-redis" description="Cleans up redis cache"> <exec executable="${path.php.executable}" passthru="true" checkreturn="true" output="${dev.null}"> <arg value="${path.bin-console}" /> <arg value="shopsys:redis:clean-cache" /> </exec> </target>
- (low priority) add a new script to
scripts/install.sh
(#759)- this script serves as a fast way to install demo instance of Shopsys Framework.
- also this script can be used if you change the configuration of docker or app, script will apply all the changes done in these files and rebuild images.
- add a way to check if Redis is running (#815)
- change version of snc/redis-bundle to ^2.1.8 in your composer.json and update dependencies with
composer update
- upgrade redis extension version in your
DockerFile
to version4.1.1
- RUN pecl install redis-4.0.2 && \ + RUN pecl install redis-4.1.1 && \
- add a new phing target
redis-check
to yourbuild-dev.xml
and use it before any call to Redis likeclear-redis
- You can find inspiration in #815
<target name="redis-check" description="Checks availability of Redis"> <exec executable="${path.php.executable}" passthru="true" checkreturn="true"> <arg value="${path.bin-console}" /> <arg value="shopsys:redis:check-availability" /> </exec> </target>
- change version of snc/redis-bundle to ^2.1.8 in your composer.json and update dependencies with
- update PHPStan to the 0.11 version (#826)
- change version of phpstan/phpstan to ^0.11 in your composer.json and update dependencies with
composer update
- add
- '#Undefined variable: \$undefined#'
as ignored error tophpstan.neon
configuration file - you may need to change
StdClass
tostdClass
intests/ShopBundle/Functional/Component/Grid/Ordering/GridOrderingFacadeTest.php
to pass PHPStan check
- change version of phpstan/phpstan to ^0.11 in your composer.json and update dependencies with
- after running database migrations, all your countries across domains will be merged together and original names will be added as translations (#762)
- all your countries have to have country code filled in
- country not present on some domain will use country code as its name and will be disabled on that domain
- please check
Version20190121094400
- use configuration file to define directories that needs to be created during build of the application (#781)
- create new configuration file
app/config/directories.yml
with 2 types of directoriespublic_directories
andinternal_directories
and add this file into$configs
array inAppKernel::getConfigs()
. - if you had implemented your individual directories in
CreateApplicationDirectoriesCommand
, delete your extension of a class and add the directories intoapp/config/directories.yml
and fill them into sections, you can read more about sections here
- create new configuration file
- if you were using
oneup/flysystembundle
for using different adapter than the local one, you must now implementFilesystemFactoryInterface
and init the adapter by yourself (#730) - (low priority) delete dependency on
oneup/flysystembundle
from yourcomposer.json
(#730)- delete
app/config/packages/oneup_flysystem.yml
- delete
- remove usages of inherited
OrderItem
classes (#715)- replace usages of
OrderProduct
,OrderPayment
, andOrderTransport
with commonOrderItem
- use
isType<type>()
method instead ofinstanceof
- use
- replace usages of
OrderTransportData
,OrderPaymentData
with commonOrderItemData
- replace usages of
OrderProductFactoryInterface
,OrderPaymentFactoryInterface
andOrderTransportFactoryInterface
with commonOrderItemFactoryInterface
- replace usages of
OrderProductFactory
,OrderPaymentFactory
andOrderTransportFactory
withOrderItemFactory
- replace usages of method
create()
withcreateProduct()
,createPayment()
orcreateTransport()
, respectively
- replace usages of
- replace usages of
OrderPaymentDataFactoryInterface
andOrderTransportDataFactoryInterface
with commonOrderItemDataFactoryInterface
- replace usages of
OrderPaymentDataFactory
andOrderTransportDataFactory
with commonOrderItemDataFactory
- replaces usages of method
createFromOrderPayment()
andcreateFromOrderTransport()
withcreateFromOrderItem()
- replace usages of
- following classes changed constructors, if you extend them, change them appropriately:
Order
OrderDataFactory
OrderItemFacade
OrderFacade
- (low priority) add an extension for
OrderItemData
andOrderItemDataFactory
and register them inservices.yml
- remove non-existing test cases from
EntityExtensionTest
- remove
ExtendedOrder*
classes - remove calling
doTestExtendedEntityInstantiation
with classes that are removed - change
ExtendedOrderItem
to standard class - removeabstract
and inheritance annotations - change
doTestExtendedOrderItemsPersistence
to test onlyOrderItem
- please find inspiration in pull request
- remove
- replace usages of
- (low priority) allow support for multiple image sizes (#766)
- implement action
getAdditionalImageAction()
inFront/ImageController.php
(or copy it from ImageController.php) - add routes into your frontend router
front_additional_image: path: /%shopsys.content_dir_name%/images/{entityName}/{type}/{sizeName}/additional_{additionalIndex}_{imageId}.{extension} defaults: { _controller: ShopsysShopBundle:Front\Image:getAdditionalImage } requirements: imageId: \d+ additionalIndex: \d+ front_additional_image_without_type: path: /%shopsys.content_dir_name%/images/{entityName}/{sizeName}/additional_{additionalIndex}_{imageId}.{extension} defaults: _controller: ShopsysShopBundle:Front\Image:getAdditionalImage type: ~ requirements: imageId: \d+ additionalIndex: \d+
- implement action
Cart
has been slightly refactored (#765), so change your usages appropriately:- property
cartItems
has been renamed toitems
- method
getCartItemById
has been renamed togetItemById
- method
getQuantifiedProductsIndexedByCartItemId
has been renamed togetQuantifiedProductsIndexedByItemId
- method
findSimilarCartItemByCartItem
has been renamed tofindSimilarItemByItem
Cart
is now entity, so change your usages appropriately:- properties
user
andcart_identifier
were moved fromCartItem
toCart
- there are new methods
getCartIdentifier
,setModifeiedNow
andsetModifiedAt
- there are new methods
- added new property
modifiedAt
- method's
addProduct
first parameterCustomerIdentifier
has been removed - method's
mergeWithCart
third parameterCustomerIdentifier
has been removed - the implementation of methods
addItem
,removeItemyId
,getItems
,getItemsCount
,changeQuantities
,getQuantifiedProductsIndexedByItemId
,mergeWithCart
andfindSimilarItemByItem
has been changed so revise them if you extended them
- properties
CartFactory
has been refactored, so change your usages appropriately:- methods
get
andcreateNewCart
has been removed, useCartFacade
'sfindCartOfCurrentCustomer
,findCartByCustomerIdentifier
,getCartOfCurrentCustomerCreateIfNotExists
orgetCartByCustomerIdentifierCreateIfNotExists
instead- methods starting with
find
can returnnull
- methods ending with
CreateIfNotExists
will always create newCart
in database, so use this methods only in case you are adding some items
- methods starting with
- method
clearCache
has been removed - attributes
carts
,cartItemRepository
andcartWatcherFacade
has been removed
- methods
CartFacade
has been refactored, so change your usages appropriately:- it has four new methods for working with
Cart
- methods
findCartOfCurrentCustomer
andfindCartByCustomerIdentifier
will returnCart
if it contains at least oneCartItem
ornull
if it is empty - methods
getCartOfCurrentCustomerCreateIfNotExists
andgetCartByCustomerIdentifierIfNotExists
will returnCart
if it contains at least oneCartItem
or create one if it does not - instead
getCartOfCurrentCustomer
usegetCartOfCurrentCustomerCreateIfNotExists
- methods
- set default locale for test environment, add a
app/config/packages/test/prezent_doctrine_translatable.yml
with contentprezent_doctrine_translatable: fallback_locale: en
- the implementation of methods
addProductToCart
,changeQuantities
,deleteCartItem
,getQuantifiedProductsOfCurrentCustomerIndexedByCartItemId
anddeleteOldCarts
has been changed so revise them if you extended them - method
cleanCart
has been removed, use methoddeleteCart
instead
- it has four new methods for working with
CartMigrationFacade
has been refactored, so change your usages appropriately:- the constructor has changed
- implementation of methods
mergeCurrentCartWithCart
andonKernelController
has been changed, so revise them if you extended them
CartItemRepository
class has been removed and all its logic has been moved to newCartRepository
CartItemFactory::create
andCartItemFactoryInterface::create
methods has changed, its first parameter is no longerCustomerIdentifier
butCart
- In twig templates (e.g.
Front/Content/Cart/index.html.twig
andFront/Inline/Cart/cartBox.html.twig
), usecart is not null
instead ofcart.itemsCount > 0
andcart.isEmpty
- You would probably need to modify your tests as well, because of changes in
Cart
. You would need to revise the following classes:Unit/Model/Cart/CartFactoryTest.php
has been removedUnit/Model/Cart/CartTest.php
has been changedFunctional/Model/Cart/CartFacadeDeleteOldCartsTest.php
has been changedFunctional/Model/Cart/CartFacadeTest.php
has been changedFunctional/Model/Cart/CartItemTest.php
has been changedFunctional/Model/Cart/CartTest.php
has been changedFunctional/Model/Cart/Watcher/CartWatcherTest.php
has been changedFunctional/Model/Order/OrderFacadeTest.php
has been changed
- property
- (low priority) upgrade npm packages to the latest version (#755)
- remove all npm packages by removing folder
project-base/node_modules
andproject-base/package-lock.json
- run command
php phing npm
- in order to pass standards tests you also need to run
php phing eslint-fix
to let ESlint npm package update your JavaScript files. After that your syntax should be updated to latest JavaScript standards checked by ESLint.- there could be error about
no-self-assign
fordocument.location
insrc/Shopsys/ShopBundle/Resources/scripts/frontend/promoCode.js
and it could be solved by replacingdocument.location = document.location
withdocument.location.reload()
(#809)
- there could be error about
- remove all npm packages by removing folder
- unify countries across domains with translations and domain dependency (#762)
- fix new entity
Country
creation (either using factory or directly) as it changed its constructor andCountryFactory::create
method signature (removed argumentdomainId
)- do not forget to fix
PersonalDataExportXmlTest
- do not forget to fix
- adjust usages of
CountryFacade
- method
create
no longer has second argumentdomainId
- remove usages of methods
getAllByDomainId
andgetAllOnCurrentDomain
as they were deleted- use new methods
getAllEnabledOnDomain
andgetAllEnabledOnCurrentDomain
(methods returns only enabled countries) - change usages in
BillingAddressFormType
,DeliveryAddressFormType
andPersonalInfoFormType
in your implementation - fix
CountryFacade
mock inPersonalInfoFormTypeTest
– mock methodgetAllEnabledOnDomain
instead ofgetAllByDomainId
- if you use
Country::getName()
in your code, fix all the usages of the method as it now needs proper locale as an argument
- use new methods
- method
- change usages of property
name
inCountryData
to array because it is now localized - remove usages of method
CountryRepository::getAllByDomainId
– useCountryRepository::getAllEnabledByDomainIdWithLocale
instead - if you have extended
CountryDataFactory
revise your changes as countries are now localized and domain dependent - adjust data fixtures, if you have your own
- remove
MultiDomainCountryDataFixture
as it does not make sense now and change dependency fromMultiDomainCountryDataFixture
toCountryDataFixture
(inMultiDomainOrderDataFixture
,MultiDomainUserDataFixture
,OrderDataFixture
andUserDataFixture
) - in
MultiDomainOrderDataFixture
,MultiDomainUserDataFixture
,OrderDataFixture
,UserDataFixture
change obtaining reference to country fromgetReferenceForDomain
togetReference
(without domain)
- remove
- class
CountryInlineEdit
(inline editable country grid) is no longer available, remove usages in favor ofCountryGridFactory
- if you have extended
CountryGridFactory
, revise your changes because class changed its namespace - if you have extended
CountryFormType
, revise your changes – new fields are available - if you have extended
CountryController
revise your changes –new
andedit
actions were added - rename
CountryDataFixture::COUNTRY_CZECH_REPUBLIC_1
constant toCountryDataFixture::COUNTRY_CZECH_REPUBLIC
- fix new entity
- if you have extended
Localization
class, you have to add type-hints to extended methods because they were added in the parent class (#806)- if you have extended method
Localization::getAdminLocale()
only to have administration in a different language than english, you can delete it and set parametershopsys.admin_locale
in yourparameters_common.yml
file instead
- if you have extended method
- fixed JS validation of forms in popup windows (#782)
- login form in popup is now loaded via AJAX
- in
window.js
add optionstextHeading = ''
andcssClassHeading: ''
tovar defaults
like this:var defaults = { content: '', buttonClose: true, buttonCancel: false, buttonContinue: false, textContinue: Shopsys.translator.trans('Yes'), textCancel: Shopsys.translator.trans('No'), + textHeading: '', urlContinue: '#', cssClass: 'window-popup--standard', cssClassContinue: '', cssClassCancel: '', + cssClassHeading: '', closeOnBgClick: true, eventClose: function () {}, eventContinue: function () {}, eventCancel: function () {}, eventOnLoad: function () {} };
- then add the heading to
$windowContent
and add div withjs-validation-errors
class to every popup.:
- var $windowContent = $('<div class="js-window-content window-popup__in"></div>').html(options.content); + var $windowContent = $('<div class="js-window-content window-popup__in"></div>'); + if (options.textHeading !== '') { + $windowContent.append('<h2 class="' + options.cssClassHeading + '">' + options.textHeading + '</h2>'); + } + $windowContent.append( + '<div class="display-none in-message in-message--alert js-window-validation-errors"></div>' + + options.content + );
- then add the heading to
- (low priority) change login form so it is loaded by AJAX and works with JS validation and change
Login/windowForm.html.twig
,Login/loginForm.html.twig
andheader.html.twig
templates- you can change it as it was done in this commit
- if you have extended classes from
Shopsys\FrameworkBundle\Model
,Shopsys\FrameworkBundle\Component
orShopsys\FrameworkBundle\DataFixtures\Demo
namespace (#788)- you need to adjust extended methods and fields to
protected
visibility because allprivate
visibilities from these namespaces were changed toprotected
- you can delete methods that you just copied due to inability to inherit
- you need to adjust extended methods and fields to
- microservices has been removed and their functionality has been moved to framework (#793):
- classes from microservices has been moved to
Shopsys\FrameworkBundle\Model\Product\Search
namespace - definitions of indexes has been moved to project folder
src/Shopsys/ShopBundle/Resources/definition
, copy them to your project as well- add
shopsys.elasticsearch.structure_dir: '%shopsys.resources_dir%/definition/'
to yourpaths.yml
config file
- add
- Symfony commands for Elasticsearch management has changed their namespace from
shopsys:microservice:product-search
toshopsys:product-search
- update your
build.xml
andbuild-dev.xml
to reflect this change - if you have extended those command in your project, update their class and file names and
$defaultName
property appropriately
- update your
StructureManager
has been moved topackages/framework/src/Component/Elasticsearch
and renamed toElasticsearchStructureManager
update your code if you extended or used it- its methods
getIndexName
,createIndex
,deleteIndex
andgetDefinition
now accept second mandatory parameterindex
update your code if you are using them- this parameter is for distinguishing different use cases like Product search
- its methods
- this classes has been moved, update your code if you extended them or used them in your code:
ProductSearchExportFacade
has been moved fromShopsys\FrameworkBundle\Model\Product\ProductSearchExport
toShopsys\FrameworkBundle\Model\Product\Search\Export
ProductSearchExportRepository
has been moved fromShopsys\FrameworkBundle\Model\Product\ProductSearchExport
toShopsys\FrameworkBundle\Model\Product\Search\Export
ProductSearchExportCronModule
has been moved fromShopsys\FrameworkBundle\Model\Product\ProductSearchExport
toShopsys\FrameworkBundle\Model\Product\Search\Export
- Phing target
microservices-check
has been removed because it is no longer necessary- update your
build-dev.xml
to reflect this change
- update your
- Phing targets starting with
microservice
has this prefix removed e.g.microservice-product-search-create-structure
has been renamed toproduct-search-create-structure
- update your
build.xml
,build-dev.xml
andkubernetes/deployments/webserver-php-fpm.yml
to reflect this change
- update your
- run
composer install
so you will be prompted to set value for new parameterelasticsearch_host
- remove all microservice Docker services and volumes from your
docker-compose
anddocker-sync
files - update your
php-fpm/Dockerfile
to include default ENV variableELASTIC_SEARCH_INDEX_PREFIX
or set this environment while buildingphp-fpm
image - if you are using Kubernetes with our prepared scripts remove all rows including word microservice from all scripts in
.ci
folder- only exception is
restart_kubernetes.sh
and line startingkubectl exec
where you removemicroservices-
prefix in names of Phing targets
- only exception is
- remove microservices from
kubernetes
deployments
andservices
folders and updatekubernetes/kustomize/base/kustomization.yaml
appropriately ProductSearchExportRepositoryTest
move fromTests\ShopBundle\Functional\Model\Product\ProductSearchExport
toTests\ShopBundle\Functional\Model\Product\Search
- in production you will need to run
product-search-recreate-structure
Phing target while next build to create indexes again with new name- after that remove previous indexes used for Product search, so they do not consume any memory (link to Elasticsearch documentation)
- classes from microservices has been moved to
- warm up the production cache before generating error pages (#816)
- in
build.xml
, create a new phing targetprod-warmup
:
<target name="prod-warmup" description="Warms up cache for production environment."> <exec executable="${path.php.executable}" passthru="true" checkreturn="true"> <arg value="${path.bin-console}" /> <arg value="cache:warmup" /> <arg value="--env=prod" /> </exec> </target>
- add a dependency on this target to
error-pages-generate
:
- <target name="error-pages-generate" description="..."> + <target name="error-pages-generate" depends="prod-warmup" description="...">
- in
- if you have extended any of following factories, provide
Domain
object to parent constructor (#787)AvailabilityDataFactory
FlagDataFactory
OrderStatusDataFactory
ParameterDataFactory
UnitDataFactory
- (low priority) if you want to test the flow of promo code in cart page, implement new acceptance tests (#825)
Tests\ShopBundle\Acceptance\acceptance\CartCest
Tests\ShopBundle\Acceptance\acceptance\PageObject\Front\CartPage
src/Shopsys/ShopBundle/Resources/views/Front/Content/Order/PromoCode/index.html.twig
- if you have extended class HeurekaCategoryDownloader or HeurekaCategoryCronModule (#788)
- you need to adjust already extended methods and fields to
protected
visibility because allprivate
visibilities from these namespaces were changed toprotected
- you can delete methods that you just copied due to inability to inherit
- you need to adjust already extended methods and fields to