6
6
namespace Magento \Sales \Block \Order ;
7
7
8
8
use Magento \Framework \View \Element \Template \Context ;
9
- use Magento \Sales \Model \ResourceModel \Order \CollectionFactory ;
10
9
use Magento \Customer \Model \Session ;
11
10
use Magento \Sales \Model \Order \Config ;
11
+ use Magento \Sales \Model \ResourceModel \Order \CollectionFactoryInterface ;
12
12
use Magento \Store \Model \StoreManagerInterface ;
13
13
use Magento \Framework \App \ObjectManager ;
14
14
@@ -26,7 +26,7 @@ class Recent extends \Magento\Framework\View\Element\Template
26
26
const ORDER_LIMIT = 5 ;
27
27
28
28
/**
29
- * @var \Magento\Sales\Model\ResourceModel\Order\CollectionFactory
29
+ * @var CollectionFactoryInterface
30
30
*/
31
31
protected $ _orderCollectionFactory ;
32
32
@@ -47,15 +47,15 @@ class Recent extends \Magento\Framework\View\Element\Template
47
47
48
48
/**
49
49
* @param \Magento\Framework\View\Element\Template\Context $context
50
- * @param \Magento\Sales\Model\ResourceModel\Order\CollectionFactory $orderCollectionFactory
50
+ * @param CollectionFactoryInterface $orderCollectionFactory
51
51
* @param \Magento\Customer\Model\Session $customerSession
52
52
* @param \Magento\Sales\Model\Order\Config $orderConfig
53
53
* @param array $data
54
54
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
55
55
*/
56
56
public function __construct (
57
57
Context $ context ,
58
- CollectionFactory $ orderCollectionFactory ,
58
+ CollectionFactoryInterface $ orderCollectionFactory ,
59
59
Session $ customerSession ,
60
60
Config $ orderConfig ,
61
61
array $ data = [],
@@ -84,11 +84,12 @@ protected function _construct()
84
84
*/
85
85
private function getRecentOrders ()
86
86
{
87
- $ orders = $ this ->_orderCollectionFactory ->create ()->addAttributeToSelect (
87
+ $ customerId = $ this ->_customerSession ->getCustomerId ();
88
+ $ orders = $ this ->_orderCollectionFactory ->create ($ customerId )->addAttributeToSelect (
88
89
'* '
89
90
)->addAttributeToFilter (
90
91
'customer_id ' ,
91
- $ this -> _customerSession -> getCustomerId ()
92
+ $ customerId
92
93
)->addAttributeToFilter (
93
94
'store_id ' ,
94
95
$ this ->storeManager ->getStore ()->getId ()
0 commit comments