Git Product home page Git Product logo

m2-datapatchcreator's People

Contributors

budnerp avatar enanobots avatar lukaszqs avatar markshust avatar piotr-budner avatar qsolutions-pl avatar septoctobre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

m2-datapatchcreator's Issues

Pages/blocks sharing code in different scopes get merged

If you have a CMS page or block with differing content in different websites but sharing the same identifier code, and try to export both at once, they'll get merged improperly and only content for one will get written to the data patch.

Steps to reproduce:

  • Have two pages or blocks with the same code but different store scopes (like footer_links_col_5)
  • Select both footer_links_col_5 blocks on the admin grid, and export with the data patch creator
2024-04-08_133924

Expected behavior:

  • Two data patches in the download, one for each selected page

Actual behavior:

  • One data patch gets created, with the content from the higher entity ID.

I haven't investigated to determine if it creates both patches but one overwrites the other due to same filename (seems likely), or if they get grouped/merged by identifier prior to patch creation.

Secondary but related, since the existing record gets loaded by identifier without any scope filter, that will also cause incorrect behavior if multiple records exist with the same identifier, as in this case.

            $cmsBlock = $this->blockFactory->create();
            $this->blockResource->load($cmsBlock, 'footer_links_col_5', 'identifier');

Saving patches locally causes odd formatting in patch script

Files look fine when downloaded, but when saved directly to a folder, weird output happens:

<?php /**
 * Created with Nanobots_DataPatchCreatorSimpleData
 * @author      Jakub Winkler <[email protected]>
 *
 * @category    MarkShust
 * @package     MarkShust_MyData
 */

declare(strict_types = 1);

namespace MarkShust\MyData\Setup\Patch\Data;

use MarkShust\SimpleData\Setup\Patch\SimpleDataPatch;

class CmsPageHome extends SimpleDataPatch
{
    public function apply(): void
    {
        $this-&gt;page-&gt;save([
                'title' =&gt; 'Home page',
                'page_layout' =&gt; '1column',
                'meta_keywords' =&gt; '',
                'meta_description' =&gt; '',
                'identifier' =&gt; 'home',
                'content_heading' =&gt; 'Home Page',
                'content' =&gt; '<div data-content-type="html" data-appearance="default" data-element="main" data-decoded="true"><p>CMS homepage content goes here.</p>
            </div>',
                'creation_time' =&gt; '2021-10-29 15:45:29',
                'update_time' =&gt; '2021-10-29 16:58:06',
                'is_active' =&gt; '1',
                'sort_order' =&gt; '0',
                'layout_update_xml' =&gt; '<!--
                    <referenceContainer name="right">
                            <referenceBlock name="catalog.compare.sidebar" remove="true" />
                    </referenceContainer>-->',
                'custom_theme' =&gt; '',
                'custom_root_template' =&gt; '',
                'custom_layout_update_xml' =&gt; null,
                'layout_update_selected' =&gt; null,
                'custom_theme_from' =&gt; null,
                'custom_theme_to' =&gt; null,
                'meta_title' =&gt; '',
                'store_id' =&gt; [
                    0 =&gt; '0',
                ],
            ]);
    }
}

Specifically, the > arrows become &gt;.

Issue:: "->" :: encoded

If i use page builder in the block or page i facing some issues after exporting the patch data. Some character are not decoded properly. I have attached the error file with this ticket. Please check and give your feedback.
OS: Ubuntu 18.04
Magento 2.4.3-p1 (vanilla instance)

<?php /**
 * Created with Nanobots_DataPatchCreator
 * @author      Jakub Winkler <[email protected]>
 * @author      Sebastian Strojwas <sebastian>
 * @author      Wojtek Wnuk <wojtek>
 *
 * @category    
 * @package     HomePageBanner
 */

namespace HomePageBanner\Setup\Patch\Data;

use Exception;
use Magento\Cms\Model\BlockFactory;
use Magento\Cms\Model\ResourceModel\Block as BlockResource;
use Magento\Framework\Setup\Patch\DataPatchInterface; 

class CmsBlockHomeBannerCategoryList implements DataPatchInterface
{
    /** @var BlockFactory */
    private $blockFactory;

    /** @var BlockResource */
    private $blockResource;

    /** 
     * @param BlockFactory $blockFactory
     * @param BlockResource $blockResource
     */
    public function __construct( 
        BlockFactory $blockFactory,
        BlockResource $blockResource
    ) { 
        $this-&gt;blockFactory = $blockFactory;
        $this-&gt;blockResource = $blockResource;
    }

    /**
     * @inheritDoc
     */
    public static function getDependencies(): array
    {
        return [];
    }

    /**
     * @inheritDoc
     */
    public function getAliases(): array
    {
        return [];
    }

    /**
     * @inheritDoc
     * @throws Exception
     */
    public function apply(): self
    {
        try {
            $cmsBlock = $this-&gt;blockFactory-&gt;create();
            $this-&gt;blockResource-&gt;load($cmsBlock, 'home-banner-category-list', 'identifier');
            $cmsBlock-&gt;addData([
                'title' =&gt; 'Home Banner Category List',
                'identifier' =&gt; 'home-banner-category-list',
                'content' =&gt; '<style>#html-body [data-pb-style=Y96V1N8]{justify-content:flex-start;display:flex;flex-direction:column;background-position:left top;background-size:cover;background-repeat:no-repeat;background-attachment:scroll}</style><div data-content-type="row" data-appearance="contained" data-element="main"><div data-enable-parallax="0" data-parallax-speed="0.5" data-background-images="{}" data-background-type="image" data-video-loop="true" data-video-play-only-visible="true" data-video-lazy-load="true" data-video-fallback-src="" data-element="inner" data-pb-style="Y96V1N8"><div data-content-type="html" data-appearance="default" data-element="main" data-decoded="true">{{widget type="SomethingDigital\\CategoryWidget\\Block\\Category\\CategoriesList" categories_count="10" template="SomethingDigital_CategoryWidget::category/widget/content/list.phtml" parent_category_id="2"}}</div></div></div>',
                'creation_time' =&gt; '2021-10-22 17:50:54',
                'update_time' =&gt; '2021-10-22 19:13:18',
                'is_active' =&gt; '1',
                'row_id' =&gt; '5',
                'created_in' =&gt; '1',
                'updated_in' =&gt; '2147483647',
                'store_id' =&gt; [
                    0 =&gt; '0',
                ],
                'stores' =&gt; [
                    0 =&gt; '0',
                ],
            ]);
            $this-&gt;blockResource-&gt;save($cmsBlock); 
            return $this;
        } catch (Exception $e) {
            throw new Exception(__('Cannot save CMS Block: %1', $e-&gt;getMessage()));
        }
    } 
}
</wojtek></sebastian>

Screenshot from 2021-10-23 01-08-18
Screenshot from 2021-10-23 01-08-04

Nanobots admin section is too prevalent

The default section when I click on System > Configuration should be General. Instead, I see the Nanobots section first. This config entry should probably be de-prioritized so it comes at the end of the system config.

Screen Shot 2021-10-29 at 12 47 15 PM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.