cancel
Showing results for 
Search instead for 
Did you mean: 

Class Magento\Sales\Model\Resource\Order\Collection does not exist

SOLVED

Class Magento\Sales\Model\Resource\Order\Collection does not exist

Hi all, 


I get " Class Magento\Sales\Model\Resource\Order\Collection does not exist" error whenever I run the setup:di:compile command. Is there a quick fix for this? 

 

I deleted Var/di, generation, cache and view_preproccessed directories before running this command. 

 

Any help is highly appreciated. 


Thanks

Shoaib

Magento Certified Solution Specialist | Lead Magento developer
If this response was helpful to you, consider giving kudos to this post
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Class Magento\Sales\Model\Resource\Order\Collection does not exist

Hi @ShoaibRehman89,

 

Looks like your installation contains a very old extensions, as the correct class name is:

\Magento\Sales\Model\ResourceModel\Order\Collection

 

In order to support PHP 7, where "Resource" is a reserved word, Resource namespace was renamed to ResourceModel long time ago.

 

Hopefully, you will be able to apply quick fix by replacing all occurrences of Magento\Sales\Model\Resource\Order to Magento\Sales\Model\ResourceModel\Order

View solution in original post

2 REPLIES 2

Re: Class Magento\Sales\Model\Resource\Order\Collection does not exist

Hi @ShoaibRehman89,

 

Looks like your installation contains a very old extensions, as the correct class name is:

\Magento\Sales\Model\ResourceModel\Order\Collection

 

In order to support PHP 7, where "Resource" is a reserved word, Resource namespace was renamed to ResourceModel long time ago.

 

Hopefully, you will be able to apply quick fix by replacing all occurrences of Magento\Sales\Model\Resource\Order to Magento\Sales\Model\ResourceModel\Order

Re: Class Magento\Sales\Model\Resource\Order\Collection does not exist

Thank you @sivashchenko for pointing me to the right direction. I have fixed the issue now. 

Magento Certified Solution Specialist | Lead Magento developer
If this response was helpful to you, consider giving kudos to this post