Tidak melanjutkan \Magento\Framework\DataObject
P粉026665919
P粉026665919 2024-01-07 11:43:27
0
1
598

Saya mengalami pengecualian semasa mencipta model. Ini adalah pengecualian:

1 exception(s):
Exception #0 (InvalidArgumentException): Training4VendorModelTraining4_Vendor2Product does not extend MagentoFrameworkDataObject

Exception #0 (InvalidArgumentException): Training4VendorModelTraining4_Vendor2Product does not extend MagentoFrameworkDataObject

Versi Magento ialah 2.4.4 Training4VendorModelLatihan4_Vendor2Product

<?php


namespace Training4VendorModel;


use MagentoFrameworkModelAbstractModel;

class Training4_Vendor2Product extends AbstractModel
{
    const vendor_id='id';

    protected $_idFieldName  = self::vendor_id;

    protected function _construct()
    {
        $this->_init(Training4VendorModelResourceModelTraining4_Vendor2Product::class);
    }
}

Latihan4VendorModelResourceModelLatihan4_Vendor2Product

<?php


namespace Training4VendorModelResourceModel;


use MagentoFrameworkModelResourceModelDbAbstractDb;

class Training4_Vendor2Product extends AbstractDb
{

    protected function _construct()
    {
        $this->_init('training4_vendor2product','id');
    }
}

Latihan4VendorModelResourceModelLatihan4_Vendor2ProductCollection

<?php


namespace Training4VendorModelResourceModelTraining4_Vendor2Product;


use MagentoFrameworkModelResourceModelDbCollectionAbstractCollection;

class Collection extends AbstractCollection
{
    protected $_idFieldName = 'id';

    protected function _construct()
    {
        $this->_init(Training4VendorModelTraining4_Vendor2Product::class,
            Training4VendorModelResourceModelTraining4_Vendor2Product::class);
    }
}

Dalam Training4VendorModelTraining4_Vendor2Product saya telah melanjutkan MagentoFrameworkModelAbstractModel dan saya tidak tahu mengapa pengecualian ini berlaku

P粉026665919
P粉026665919

membalas semua(1)
P粉953231781

Adakah anda menambah kebergantungan dalam di.xml


    
        training4_vendor2product
        Training4\Vendor\Model\ResourceModel\Training4_Vendor2Product
    
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan
Tentang kita Penafian Sitemap
Laman web PHP Cina:Latihan PHP dalam talian kebajikan awam,Bantu pelajar PHP berkembang dengan cepat!