44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* Copyright © All rights reserved.
|
|
* See COPYING.txt for license details.
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
namespace Lts\Inventory\Block\Index;
|
|
|
|
use Lts\Inventory\Api\SourceCustomerInterface;
|
|
use Lts\Inventory\Api\SourceCustomerRepositoryInterface;
|
|
use Magento\Customer\Model\Session;
|
|
use Magento\Framework\Exception\LocalizedException;
|
|
|
|
class Index extends \Magento\Framework\View\Element\Template
|
|
{
|
|
|
|
/**
|
|
* Constructor
|
|
*
|
|
* @param \Magento\Framework\View\Element\Template\Context $context
|
|
* @param array $data
|
|
*/
|
|
public function __construct(
|
|
\Magento\Framework\View\Element\Template\Context $context,
|
|
Session $customerSession,
|
|
SourceCustomerRepositoryInterface $sourceCustomerRepository,
|
|
array $data = []
|
|
) {
|
|
$this->customerSession = $customerSession;
|
|
$this->sourceCustomerRepository = $sourceCustomerRepository;
|
|
parent::__construct($context, $data);
|
|
}
|
|
|
|
/**
|
|
* @return \Lts\Inventory\Api\Data\SourceCustomerInterface[]
|
|
* @throws LocalizedException
|
|
*/
|
|
public function getInventorySources() {
|
|
return $this->sourceCustomerRepository->getList((string)$this->customerSession->getCustomerId())->getItems();
|
|
}
|
|
}
|
|
|