Skip to main content
added 830 characters in body
Source Link
Model\Reorder\Data\ReorderOutput must be compatible with Magento\Sales\Model\Reorder\Reorder::execute(string $orderNumber, string $storeId): Magento\Sales\Model\Reorder\Data\ReorderOutput

I am getting the above error while trying to override the module. I am trying with the preference to override the execute method.

code:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
     <preference for="Magento\Sales\Model\Reorder\Reorder" type="Test\CustomReorder\Model\Reorder\Reorder"/>
</config>

file:

 <?php

namespace Test\CustomReorder\Model;

class Reorder extends \Magento\Sales\Model\Reorder\Reorder
{
 public function execute(string $orderNumber, string $storeId): Data\ReorderOutput
    { 
       $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/test.log');
$logger = new \Zend\Log\Logger();
$logger->addWriter($writer);
$logger->info('confirmed');
die('abc');      
    }
}
Model\Reorder\Data\ReorderOutput must be compatible with Magento\Sales\Model\Reorder\Reorder::execute(string $orderNumber, string $storeId): Magento\Sales\Model\Reorder\Data\ReorderOutput

I am getting the above error while trying to override the module. I am trying with the preference to override the execute method.

Model\Reorder\Data\ReorderOutput must be compatible with Magento\Sales\Model\Reorder\Reorder::execute(string $orderNumber, string $storeId): Magento\Sales\Model\Reorder\Data\ReorderOutput

I am getting the above error while trying to override the module. I am trying with the preference to override the execute method.

code:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
     <preference for="Magento\Sales\Model\Reorder\Reorder" type="Test\CustomReorder\Model\Reorder\Reorder"/>
</config>

file:

 <?php

namespace Test\CustomReorder\Model;

class Reorder extends \Magento\Sales\Model\Reorder\Reorder
{
 public function execute(string $orderNumber, string $storeId): Data\ReorderOutput
    { 
       $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/test.log');
$logger = new \Zend\Log\Logger();
$logger->addWriter($writer);
$logger->info('confirmed');
die('abc');      
    }
}
added 8 characters in body
Source Link
Mohit Patel
  • 4k
  • 4
  • 24
  • 53

Model\Reorder\Data\ReorderOutput must be compatible with Magento\Sales\Model\Reorder\Reorder::execute(string $orderNumber, string $storeId): Magento\Sales\Model\Reorder\Data\ReorderOutput

Model\Reorder\Data\ReorderOutput must be compatible with Magento\Sales\Model\Reorder\Reorder::execute(string $orderNumber, string $storeId): Magento\Sales\Model\Reorder\Data\ReorderOutput

I am getting the above error while trying to override the module. I am trying with the preference to override the execute method.

Model\Reorder\Data\ReorderOutput must be compatible with Magento\Sales\Model\Reorder\Reorder::execute(string $orderNumber, string $storeId): Magento\Sales\Model\Reorder\Data\ReorderOutput

I am getting the above error while trying to override the module. I am trying with the preference to override the execute method.

Model\Reorder\Data\ReorderOutput must be compatible with Magento\Sales\Model\Reorder\Reorder::execute(string $orderNumber, string $storeId): Magento\Sales\Model\Reorder\Data\ReorderOutput

I am getting the above error while trying to override the module. I am trying with the preference to override the execute method.

Source Link

Magento 2.4 : How to override \Magento\Sales\Model\Reorder\Reorderp model?

Model\Reorder\Data\ReorderOutput must be compatible with Magento\Sales\Model\Reorder\Reorder::execute(string $orderNumber, string $storeId): Magento\Sales\Model\Reorder\Data\ReorderOutput

I am getting the above error while trying to override the module. I am trying with the preference to override the execute method.