0

I am trying to get a save button on a dynamic row field to fire but on loading a CMS page I get the following error:

Class Brancom\PageExtensions\Block\Adminhtml\DynamicRows\Edit\SaveButton
             does not exist";i:1;s:9517:"#0 /home/forge/hiflex.brancomdev.nl/public/vendor/magento/framework/Code/Reader/ClassReader.php(19): ReflectionClass->__construct('Brancom\\PageExt...')

But the Class exists on the specified location, you can see the class here:

<?php
namespace Brancom\PageExtensions\Block\Adminhtml\DynamicRows\Edit;

use Magento\Customer\Block\Adminhtml\Edit\GenericButton;
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;

class SaveButton extends GenericButton implements ButtonProviderInterface
{

    public function getButtonData()
    {
        $url = $this->getUrl('brancom/row/save');

        return [
            'label' => __('Save Rows'),
            'class' => 'save primary',
            'on_click' => "setLocation('". $url ."'')",
            'sort_order' => 90,
        ];
    }
}

The call to the class below:

    <fieldset name="related_product">
    <argument name="data" xsi:type="array">
        <item name="js_config" xsi:type="array">
            <item name="provider" xsi:type="string">dynamic_rows.dynamic_rows_data_source</item>
            <item name="deps" xsi:type="string">dynamic_rows.dynamic_rows_data_source</item>
        </item>
        <item name="label" xsi:type="string" translate="true">Dynamic Rows</item>
        <item name="config" xsi:type="array">
            <item name="dataScope" xsi:type="string">data</item>
            <item name="namespace" xsi:type="string">dynamic_rows</item>
        </item>
        <item name="template" xsi:type="string">templates/form/collapsible</item>
        <item name="buttons" xsi:type="array">
            <item name="save" xsi:type="string">Brancom\PageExtensions\Block\Adminhtml\DynamicRows\Edit\SaveButton</item>
        </item>
    </argument>

The file rests in the correct location but I still seem to do something wrong, does anybody know why my class does not exist according to magento?

2 Answers 2

1

I already encounter a similar issue, I fixed it with the following set of commands

rm -rf var/cache/* generated/*
chmod -R 777 var/ pub/static/ generated
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f
bin/magento cache:flush
chmod -R 777 var/ pub/static/ generated/

Hope it can help !

Cf: Installation issue : Uncaught ReflectionException: Class Magento\Framework\App\ResourceConnection\Proxy does not exist

2
  • Doesn't seem to fix my problem sadly, thanks for the help anyways! :) Aug 20, 2020 at 13:32
  • I also had the same issue a second time but this time it was docker related, i don't think this is your issue but we never know...i Had the docker running on the same docker port as an other project I was working on, and the docker was a little bit lost...and at the end even if I used to command on the project 1...she was working on the project 2. If this is your issue just shut down the second docker container or change the port of one of them and rebuild the container.
    – Claims
    Aug 20, 2020 at 14:39
0

Please update the composer by using this command : composer update

1
  • I didn't add anything with composer, and call a selfmade class. Why would I need to do that? Aug 20, 2020 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.