Esempio n. 1
0
 /**
  * Get data
  *
  * @return array
  */
 public function getData()
 {
     if (isset($this->loadedData)) {
         return $this->loadedData;
     }
     $items = $this->collection->getItems();
     /** @var Customer $customer */
     foreach ($items as $customer) {
         $result['customer'] = $customer->getData();
         unset($result['address']);
         /** @var Address $address */
         foreach ($customer->getAddresses() as $address) {
             $addressId = $address->getId();
             $address->load($addressId);
             $result['address'][$addressId] = $address->getData();
             $this->prepareAddressData($addressId, $result['address'], $result['customer']);
         }
         $this->loadedData[$customer->getId()] = $result;
     }
     $data = $this->getSession()->getCustomerFormData();
     if (!empty($data)) {
         $customerId = isset($data['customer']['entity_id']) ? $data['customer']['entity_id'] : null;
         $this->loadedData[$customerId] = $data;
         $this->getSession()->unsCustomerFormData();
     }
     return $this->loadedData;
 }
 /**
  * @inheritdoc
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->collection->addAttributeToSelect('*');
     $customerCollection = $this->collection->getItems();
     /** @var $customer Customer */
     foreach ($customerCollection as $customer) {
         $customer->load($customer->getId());
         if (!$this->encryptor->validateHashVersion($customer->getPasswordHash())) {
             list($hash, $salt, $version) = explode(Encryptor::DELIMITER, $customer->getPasswordHash(), 3);
             $version .= Encryptor::DELIMITER . Encryptor::HASH_VERSION_LATEST;
             $customer->setPasswordHash($this->encryptor->getHash($hash, $salt, $version));
             $customer->save();
             $output->write(".");
         }
     }
     $output->writeln(".");
     $output->writeln("<info>Finished</info>");
 }
Esempio n. 3
0
 /**
  * Get data
  *
  * @return array
  */
 public function getData()
 {
     if (isset($this->loadedData)) {
         return $this->loadedData;
     }
     $items = $this->collection->getItems();
     /** @var Customer $customer */
     foreach ($items as $customer) {
         $result['customer'] = $customer->getData();
         unset($result['address']);
         /** @var Address $address */
         foreach ($customer->getAddresses() as $address) {
             $addressId = $address->getId();
             $address->load($addressId);
             $result['address'][$addressId] = $address->getData();
             $this->prepareAddressData($addressId, $result['address'], $result['customer']);
         }
         $this->loadedData[$customer->getId()] = $result;
     }
     return $this->loadedData;
 }