Skip to content

Warning: call_user_func() expects parameter 1 to be a valid callback

it is the first time that I have asked a question in the magento community since I started working in a company that uses this framework for ecommerce a month ago. It turns out that I am inside a module in which I have to add a cms-page programmatically,

namespace Movistar Installers Setup Patch Data;

As you will see, it is a patch. My class is the following:

<? php
namespace Movistar  Installers  Setup  Patch  Data;

class CmsPageError404_V1 extends  Movistar  Installers  Model  InstallerBase
{

    
    / **
     * {@inheritdoc}
     * /
    public function apply ()
    {
        $ this-> moduleDataSetup-> startSetup ();

        $ this-> removeCmsPage (1);
        $ this-> getDependencies ();
        $ pageHtmlContent = <<< HTML
        <style>
        .cms-index-noroute {
        text-align: center;
            margin-top: 3%;
        }

            .cms-index-noroute .main-wrapper .ready-text {font-size: 2em; text-align: center; }
            .main-container.col1-layout {
                padding: 0;
                margin: 0;
                max-width: 100%;
            }

        .cms-index-noroute. main-wrapper {
        width: 100%;
        height: auto;

        }

        .ready-text {
        margin-bottom: 3%;
        }

        .ready-text span {
        color: # 00a9e0;
        font-family: "TelefonicaWeb"
        font-weigth: 100;
        }

        .order-failure-text span strong {
        font-family: "TelefonicaWeb-Bold", "TelefonicaWeb-Regular", "Helvetica Neue", Verdana, Arial, sans-serif;
        font-weigth: bold;
        font-size: 18px;
        }
        </style>

        <div class = "cms-index-noroute cms-no-route">
            <div class = "main-wrapper">
                <div class = "failure-image-wrapper">
                    <img alt = "Ups" class = "img-responsive" src = "{{media url = & quot; wysiwyg / features / failure-img.png & quot;}}" />
                </div>
                <div class = "ready-text">
                    <span style = "font-family: 'TelefonicaWeb'; font-weight: 100;" > This team is no longer available :-( </span>
                </div>
                <div class = "order-failure-text">
                    <span>
                        <strong style = "color: # 636363;"> Look at other offers we have for you CmsPageError404_V1: </strong>
                    </span>
                </div>
                <div class = "thanks-text">

                </div>
            </div>
        .
            <div id = "movistar-notfound-individuals">
            {{widget type = "Magento  CatalogWidget  Block  Product  ProductsList" show_pager = "1" products_per_page = "5" products_count = "12" template = "Magento_CatalogWidget :: product / widget / content / grid.phtml"
                conditions_encoded = "^ [` 1`: ^ [`type`:` Magento || CatalogWidget || Model || Rule || Condition || Combine`, `aggregator`:` all`, `value`:` 1`, `new_child`:` `^] ^]" page_var_name = "pqjxuq"}}
            </div>
        .
            <div id = "movistar-notfound-business">
                {{block type = "catalog / product_list" name = "home.catalog.product.list" alias = "products_homepage" category_id = "7" template = "catalog / product / list.phtml"}}
            </div>
        .
            <div id = "movistar-notfound-used">
                {{block type = "catalog / product_list" name = "home.catalog.product.list" alias = "products_homepage" category_id = "6" template = "catalog / product / list.phtml"}}
            </div>
        .
            <div class = "buttons-set" id = "see-more" style = "text-align: center;">
                <button class = "button" onclick = "window.location = 'https: //tienda.movistar.com.ar/? p = 2'" title = "See other computers" type = "button" style = "width: 20%; height: 49px; ">
                    <span>
                        <span style = "color: white;"> See more teams </span>
                    </span>
                </button>
            </div>
        </div>
        .
        <script>
            var currentLocation = window.location,
            isBusiness = String (currentLocation) .includes ("business"),
            isUsed = String (currentLocation) .includes ("cellphones-used");
            var url = window.location.href;
            .
            dataLayer.push ({
                'event': 'trackEvent',
                'eventCategory': 'Movistar Store',
                'eventAction': 'URL no teams',
                'eventLabel': url
            });
            if (isBusiness) {
                document.getElementById ("movistar-notfound-individuals"). style.display = "none";
                document.getElementById ("movistar-notfound-used"). style.display = "none";
            } else if (isUsed) {
                document.getElementById ("movistar-notfound-individuals"). style.display = "none";
                document.getElementById ("movistar-notfound-business"). style.display = "none";
            } else {
                document.getElementById ("movistar-notfound-used"). style.display = "none";
                document.getElementById ("movistar-notfound-business"). style.display = "none
";
             }
         </script>
         HTML;

         $ this-> createCmsPage (1, $ pageHtmlContent, 'Page not found');
         $ this-> moduleDataSetup-> endSetup ();
     }

     public static function getDependencies ()
     {
         return [
             InstallerBase :: class,
             DataPatchInterface :: class,
             PatchInterface :: class,
             DependentPatchInterface :: class
         ];
     }
}

the problem arises when I want to run php bin / magento setup: upgrade to raise said cms-page.

Error: Warning: call_user_func () expects parameter 1 to be a valid callback, class ‘Movistar Installers Setup Patch Data CmsPageError404_V1’ not found in / var / www / html / magento-2 / project-community-edition / vendor / magento / framework / Setup / Patch / PatchRegistry.php on line 141

Thank you very much in advance if you can help me !!!