当前位置: 首页>>代码示例>>PHP>>正文


PHP CustomerRepositoryInterface::get方法代码示例

本文整理汇总了PHP中Magento\Customer\Api\CustomerRepositoryInterface::get方法的典型用法代码示例。如果您正苦于以下问题:PHP CustomerRepositoryInterface::get方法的具体用法?PHP CustomerRepositoryInterface::get怎么用?PHP CustomerRepositoryInterface::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Customer\Api\CustomerRepositoryInterface的用法示例。


在下文中一共展示了CustomerRepositoryInterface::get方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->logger->log('Installing orders:');
     foreach ($this->fixtures as $file) {
         $fileName = $this->fixtureHelper->getPath($file);
         $csvReader = $this->csvReaderFactory->create(['fileName' => $fileName, 'mode' => 'r']);
         $isFirst = true;
         foreach ($csvReader as $row) {
             if ($isFirst) {
                 $customer = $this->customerRepository->get($row['customer_email']);
                 if (!$customer->getId()) {
                     continue;
                 }
                 /** @var \Magento\Sales\Model\Resource\Collection $orderCollection */
                 $orderCollection = $this->orderCollectionFactory->create();
                 $orderCollection->addFilter('customer_id', $customer->getId());
                 if ($orderCollection->count() > 0) {
                     break;
                 }
             }
             $isFirst = false;
             $orderData = $this->converter->convertRow($row);
             $this->orderProcessor->createOrder($orderData);
             $this->logger->logInline('.');
         }
     }
 }
开发者ID:vinai-drive-by-commits,项目名称:magento2-sample-data,代码行数:30,代码来源:Order.php

示例2: install

 /**
  * {@inheritdoc}
  */
 public function install(array $fixtures)
 {
     foreach ($fixtures as $file) {
         $fileName = $this->fixtureManager->getFixture($file);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fileName);
         $header = array_shift($rows);
         $isFirst = true;
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $row = $data;
             if ($isFirst) {
                 $customer = $this->customerRepository->get($row['customer_email']);
                 if (!$customer->getId()) {
                     continue;
                 }
                 /** @var \Magento\Sales\Model\ResourceModel\Collection $orderCollection */
                 $orderCollection = $this->orderCollectionFactory->create();
                 $orderCollection->addFilter('customer_id', $customer->getId());
                 if ($orderCollection->count() > 0) {
                     break;
                 }
             }
             $isFirst = false;
             $orderData = $this->converter->convertRow($row);
             $this->orderProcessor->createOrder($orderData);
         }
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:37,代码来源:Order.php

示例3: execute

 /**
  * Customer locking implementation
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return $this
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     $username = $observer->getEvent()->getData('username');
     $customer = $this->customerRepository->get($username);
     if ($customer && $customer->getId()) {
         $this->accountManagementHelper->processCustomerLockoutData($customer->getId());
         $this->customerRepository->save($customer);
     }
     return $this;
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:16,代码来源:CustomerInvalidPasswordObserver.php

示例4: createOrder

 /**
  * @param array $orderData
  * @return void
  */
 public function createOrder($orderData)
 {
     $this->setPhraseRenderer();
     if (!empty($orderData)) {
         $orderCreateModel = $this->processQuote($orderData);
         if (!empty($orderData['payment'])) {
             $orderCreateModel->setPaymentData($orderData['payment']);
             $orderCreateModel->getQuote()->getPayment()->addData($orderData['payment']);
         }
         $customer = $this->customerRepository->get($orderData['order']['account']['email'], $this->storeManager->getWebsite()->getId());
         $orderCreateModel->getQuote()->setCustomer($customer);
         $orderCreateModel->getSession()->setCustomerId($customer->getId());
         $order = $orderCreateModel->importPostData($orderData['order'])->createOrder();
         $orderItem = $this->getOrderItemForTransaction($order);
         $this->invoiceOrder($orderItem);
         $this->shipOrder($orderItem);
         if ($orderData['refund'] === "yes") {
             $this->refundOrder($orderItem);
         }
         $registryItems = ['rule_data', 'currently_saved_addresses', 'current_invoice', 'current_shipment'];
         $this->unsetRegistryData($registryItems);
         $this->currentSession->unsQuoteId();
         $this->currentSession->unsStoreId();
         $this->currentSession->unsCustomerId();
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:30,代码来源:Processor.php

示例5: getCustomerIdByEmail

 /**
  * @param string $customerEmail
  * @return int|null
  */
 protected function getCustomerIdByEmail($customerEmail)
 {
     $customerData = $this->customerRepository->get($customerEmail);
     if ($customerData) {
         return $customerData->getId();
     }
     return null;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:Review.php

示例6: loginViaCustomerAttributeOrEmail

 /**
  * Process login by customer attribute or email
  *
  * @param string $username Username
  * @return bool|\Magento\Customer\Api\Data\CustomerInterface
  */
 private function loginViaCustomerAttributeOrEmail($username)
 {
     $customer = $this->findCustomerByLoginAttribute($username);
     if (false === $customer) {
         $customer = $this->customerRepository->get($username);
     }
     return $customer;
 }
开发者ID:semaio,项目名称:magento2-advancedlogin,代码行数:14,代码来源:AccountManagement.php

示例7: testDeleteById

 /**
  * @magentoAppArea adminhtml
  * @magentoDataFixture Magento/Customer/_files/customer.php
  * @magentoAppIsolation enabled
  */
 public function testDeleteById()
 {
     $fixtureCustomerEmail = 'customer@example.com';
     $fixtureCustomerId = 1;
     $this->customerRepository->deleteById($fixtureCustomerId);
     /** Ensure that customer was deleted */
     $this->setExpectedException('Magento\\Framework\\Exception\\NoSuchEntityException', 'No such entity with email = customer@example.com, websiteId = 1');
     $this->customerRepository->get($fixtureCustomerEmail);
 }
开发者ID:vasiljok,项目名称:magento2,代码行数:14,代码来源:CustomerRepositoryTest.php

示例8: getAccountInformation

 /**
  * @param string $email
  * @return array
  */
 protected function getAccountInformation($email)
 {
     $customer = $this->customerRepository->get($email);
     $account = ['email' => $customer->getEmail(), 'group_id' => $customer->getGroupId()];
     foreach ($customer->getAddresses() as $customerAddress) {
         if ($customerAddress->isDefaultBilling()) {
             $account['billing_address'] = $this->getAddresses($customerAddress);
         }
         if ($customerAddress->isDefaultShipping()) {
             $account['shipping_address'] = $this->getAddresses($customerAddress);
         }
     }
     return $account;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:18,代码来源:Converter.php

示例9: isEmailAvailable

 /**
  * {@inheritdoc}
  */
 public function isEmailAvailable($customerEmail, $websiteId = null)
 {
     try {
         if ($websiteId === null) {
             $websiteId = $this->storeManager->getStore()->getWebsiteId();
         }
         $this->customerRepository->get($customerEmail, $websiteId);
         return false;
     } catch (NoSuchEntityException $e) {
         return true;
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:AccountManagement.php

示例10: iAmLoggedInAs

 /**
  * @Given I am logged in as :customerEmail
  */
 public function iAmLoggedInAs($customerEmail)
 {
     $this->customer = $this->customerRepository->get($customerEmail);
 }
开发者ID:eBayEnterprise,项目名称:magento2-retail-order-management,代码行数:7,代码来源:IntegrationContext.php


注:本文中的Magento\Customer\Api\CustomerRepositoryInterface::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。