I tried to override a custom module model with creating a new module, i got class not found error


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="V1_M1" setup_version="1.0.0">
        <module name="V2_M2"/>


<?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="V2\M2\Model\Quote\Email\Sender\QuoteProposalSender" type="V1\M1\Model\Quote\Email\Sender\QuoteProposalSender" />

class Model/Quote/Email/Sender/QuoteProposalSender.php

namespace V1\M1\Model\Quote\Email\Sender;

class QuoteProposalSender extends \V2\M2\Model\Quote\Email\Sender\QuoteProposalSender

public function checkAndSend(
    \V2\M2\Model\Quote $quote,$attachments = null) {
    return $this->traitCheckAndSend($quote, $attachments);


When executing the command

php bin/magento setup:di:compile

I got this error

PHP Fatal error:  Class 'V2\M2\Model\Quote\Email\Sender\QuoteProposalSender' not found in /app/code/V1/M1/Model/Quote/Email/Sender/QuoteProposalSender.php on line 14
  • Have you find the solution? – aravind Jul 16 at 12:15
  • Check the spelling of folder. – Sohel Rana Jul 16 at 16:56
  • The module works on server but not on localhost, i think there's issue related to V2_M2 module – tarek fellah Jul 16 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.