Media Files: List of fetched media files are overridden
Created by: roma-glushko
Describe the bug
Firegento\ContentProvisioning\Model\Config\Parser\ParserChain
collects arrays with CMS content attributes from different parsers and use array_merge()
function to merge them all together. array_merge()
function replaces the keys of values if they are duplicated and this is fine for attributes like is_active
. However, this leads to an issue if we take media_files
key. We will get media_files overridden if there is more then one parser that return this key.
This is a case when project uses Firegento_ContentProvisioning with TechDivision_PageDesignerContentProvisioning
(https://github.com/techdivision/pagedesigner-content-provisioning)
To Reproduce Steps to reproduce the behavior:
- Install Firegento_ContentProvisioning v1.2.1
- Install TechDivision_PageDesignerContentProvisioning v.1.1.1
- Try to add to the maintanence a CMS block that has images in HTML (like {{media}} directives) and in the PageDesigner encoded JSON (like {{media}} directives or {{widget}} instances with images)
Expected behavior Images from HTML and JSON are collected all togehter and deployed
Actual behavior Only images from the last called parser (a parser from TechDivision_PageDesignerContentProvisioning) are present and deployed