Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Address.php
Go to the documentation of this file.
1 <?php
7 
9 
16 {
20  protected $_customerSession;
21 
25  protected $_formKeyValidator;
26 
31 
35  protected $_formFactory;
36 
41 
45  protected $regionDataFactory;
46 
50  protected $_dataProcessor;
51 
55  protected $dataObjectHelper;
56 
61 
65  protected $resultPageFactory;
66 
81  public function __construct(
82  \Magento\Framework\App\Action\Context $context,
83  \Magento\Customer\Model\Session $customerSession,
84  \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator,
85  \Magento\Customer\Model\Metadata\FormFactory $formFactory,
86  \Magento\Customer\Api\AddressRepositoryInterface $addressRepository,
87  \Magento\Customer\Api\Data\AddressInterfaceFactory $addressDataFactory,
88  \Magento\Customer\Api\Data\RegionInterfaceFactory $regionDataFactory,
89  \Magento\Framework\Reflection\DataObjectProcessor $dataProcessor,
90  \Magento\Framework\Api\DataObjectHelper $dataObjectHelper,
91  \Magento\Framework\Controller\Result\ForwardFactory $resultForwardFactory,
92  \Magento\Framework\View\Result\PageFactory $resultPageFactory
93  ) {
94  $this->_customerSession = $customerSession;
95  $this->_formKeyValidator = $formKeyValidator;
96  $this->_formFactory = $formFactory;
97  $this->_addressRepository = $addressRepository;
98  $this->addressDataFactory = $addressDataFactory;
99  $this->regionDataFactory = $regionDataFactory;
100  $this->_dataProcessor = $dataProcessor;
101  $this->dataObjectHelper = $dataObjectHelper;
102  $this->resultForwardFactory = $resultForwardFactory;
103  $this->resultPageFactory = $resultPageFactory;
104  parent::__construct($context);
105  }
106 
112  protected function _getSession()
113  {
115  }
116 
124  {
125  if (!$this->_getSession()->authenticate()) {
126  $this->_actionFlag->set('', 'no-dispatch', true);
127  }
128  return parent::dispatch($request);
129  }
130 
136  protected function _buildUrl($route = '', $params = [])
137  {
139  $urlBuilder = $this->_objectManager->create(\Magento\Framework\UrlInterface::class);
140  return $urlBuilder->getUrl($route, $params);
141  }
142 }
$addressRepository
__construct(\Magento\Framework\App\Action\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator, \Magento\Customer\Model\Metadata\FormFactory $formFactory, \Magento\Customer\Api\AddressRepositoryInterface $addressRepository, \Magento\Customer\Api\Data\AddressInterfaceFactory $addressDataFactory, \Magento\Customer\Api\Data\RegionInterfaceFactory $regionDataFactory, \Magento\Framework\Reflection\DataObjectProcessor $dataProcessor, \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, \Magento\Framework\Controller\Result\ForwardFactory $resultForwardFactory, \Magento\Framework\View\Result\PageFactory $resultPageFactory)
Definition: Address.php:81
dispatch(RequestInterface $request)
Definition: Address.php:123
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18