2

The following errors are showing in my custom module when generating report using Upgrade compatibility tool. in 2.4.5

Using class 'Magento\Company\Model\ResourceModel\Company\Collection' that is non API on version '2.4.5'

Using class 'Magento\Framework\Model\ResourceModel\Db\Context' that is non API on version '2.4.5'

Using class 'Magento\Quote\Model\ResourceModel\Quote\Item' that is non API on version '2.4.5'

Please advise how to fix these issues?

1 Answer 1

0

To fix "Using class that is non API on version '2.4.x'" and "Implemented interface that is non API on version '2.4.x'", mark that class as @api in docblock.

Example 1:

Interface before adding @api tag:

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\Framework\GraphQl\Schema;

/**
 * Marker interface for all types compatible with GraphQL schema generator.
 */
interface TypeInterface
{
}

After adding @api tag:

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\Framework\GraphQl\Schema;

/**
 * Marker interface for all types compatible with GraphQL schema generator.
 *
 * @api
 */
interface TypeInterface
{
}

Example 2: Class before adding @api tag:

<?php

namespace VendorName\ModuleName\Model\ResourceModel\Company;

use \VendorName\ModuleName\Model\ResourceModel\AbstractCollection;

/**
 * Company collection
 */
class Collection extends AbstractCollection
{
}

After adding @api tag:

<?php

namespace VendorName\ModuleName\Model\ResourceModel\Company;

use \VendorName\ModuleName\Model\ResourceModel\AbstractCollection;

/**
 * Company collection
 *
 * @api
 */
class Collection extends AbstractCollection
{
}
7
  • Can you share me one example pls? Oct 7, 2022 at 6:10
  • @NagarajuKasa I've updated my answer, please take a look. If you still need another example, feel free to let me know.
    – Tu Van
    Oct 7, 2022 at 6:18
  • thank you for the answer. is there any alternative way to fix my above issue? pls advise Oct 12, 2022 at 9:21
  • For magento core modules you should ignore it, for your module, you should apply the fix I mentioned above. I've also added another example.
    – Tu Van
    Oct 12, 2022 at 11:05
  • I have followed this but not working in Adobe Commerce ver. 2.4.5 is there any alternative way (or) other solution for the above issue ? Oct 17, 2022 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.