Skip to content

Facing this issue, It contains 1 abstract method and must therefore be declared abstract or implement the remaining method

Facing fatal error given as below.

Fatal error: Class SugarcodeTestModelTotalFee contains 1 abstract
method and must therefore be declared abstract or implement the
remaining methods
(MagentoFrameworkDataObjectIdentityInterface::getIdentities) in
/home/dukaania/public_html/testing2/app/code/Sugarcode/Test/Model/Total/Fee.php
on line 7

Here is my code

    <?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace SugarcodeTestModelTotal;
class Fee extends MagentoFrameworkModelAbstractModel implements MagentoFrameworkDataObjectIdentityInterface {

     const CACHE_TAG = 'mr_dukaaniatest';
    protected $_cacheTag = 'mr_dukaaniatest';
    protected $_eventPrefix = 'mr_dukaaniatest';

    protected function _construct()
    {
        $this->_init('SugarcodeTestModelResourceModelFee.php');
    }

    /**
     * Collect grand total address amount
     *
     * @param MagentoQuoteModelQuote $quote
     * @param MagentoQuoteApiDataShippingAssignmentInterface $shippingAssignment
     * @param MagentoQuoteModelQuoteAddressTotal $total
     * @return $this
     */

   protected $_feeFactory;

    public function __construct(
            SugarcodeTestModelTotalFeeFactory $feeFactory
            ) {
                  parent::__construct($context);

        $this->_feeFactory = $feeFactory;

    }

    public function collect(

    ) {
        parent::collect($quote, $shippingAssignment, $total);
    }

public function getIdentities();

 public function fetch() {      

        $fee = $this->_feeFactory->create();
        $collection = $fee->getCollection();
        foreach($collection as $item){
            Zend_Debug::dump($item->getData());
        }
        exit();
    }

      public function execute()
    {
        $fee = $this->_feeFactory->create();
        $collection = $fee->getCollection();
        foreach($collection as $item){
            Zend_Debug::dump($item->getData());
        }
        exit();
    }

    /**
     * Get Subtotal label
     *
     * @return MagentoFrameworkPhrase
     */
    public function getLabel() {
        return __('Fee');
    }

}