Magento 2 How to override protected funtion in abstract class?

Viewed 13765

I want to override protected function of abstract class in magento2

here is my code

di.xml

<?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\Order\Pdf\AbstractPdf" type="Custom\Sales\Model\Order\Pdf\AbstractPdf" />
</config>

AbstractPdf.php(Custom/Sales/Model/Order/Pdf/AbstractPdf.php)

<?php
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

namespace Custom\Sales\Model\Order\Pdf;

// use Magento\Eav\Model\Entity\Attribute as EntityAttribute;
// use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
// use Magento\Framework\DB\Select;
// use Magento\Framework\Model\AbstractModel;
// use Magento\Framework\App\Filesystem\DirectoryList;
// use Magento\Framework\DataObject;

/**
 * Sales Order PDF abstract model
 * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
 */
class AbstractPdf extends \Magento\Sales\Model\Order\Pdf\AbstractPdf
{

    /**
     * Insert logo to pdf page
     *
     * @param \Zend_Pdf_Page &$page
     * @param null $store
     * @return void
     * @SuppressWarnings(PHPMD.CyclomaticComplexity)
     */
    protected function insertLogo(&$page, $store = null)
    {
        echo "override";die;
    }

}

I have override the core model with above mentioned file but i am unable to get the solution.

Please help me to solve this.

1 Answers
Related