/**
  * @param array $data
  * @return Struct\Customer\Group
  */
 public function hydrate(array $data)
 {
     $customerGroup = new Struct\Customer\Group();
     $customerGroup->setId((int) $data['__customerGroup_id']);
     $customerGroup->setName($data['__customerGroup_description']);
     $customerGroup->setDisplayGrossPrices((bool) $data['__customerGroup_tax']);
     $customerGroup->setKey($data['__customerGroup_groupkey']);
     $customerGroup->setMinimumOrderValue((double) $data['__customerGroup_minimumorder']);
     $customerGroup->setPercentageDiscount((double) $data['__customerGroup_discount']);
     $customerGroup->setSurcharge((double) $data['__customerGroup_minimumordersurcharge']);
     $customerGroup->setUseDiscount((bool) $data['__customerGroup_mode']);
     if (!empty($data['__customerGroupAttribute_id'])) {
         $attribute = $this->attributeHydrator->hydrate($this->extractFields('__customerGroupAttribute_', $data));
         $customerGroup->addAttribute('core', $attribute);
     }
     return $customerGroup;
 }
Exemple #2
0
 /**
  * @param Models\Customer\Group $group
  * @return Struct\Customer\Group
  */
 public function convertCustomerGroup(Models\Customer\Group $group)
 {
     $customerGroup = new Struct\Customer\Group();
     $customerGroup->setKey($group->getKey());
     $customerGroup->setUseDiscount($group->getMode());
     $customerGroup->setId($group->getId());
     $customerGroup->setPercentageDiscount($group->getDiscount());
     $customerGroup->setDisplayGrossPrices($group->getTax());
     $customerGroup->setMinimumOrderValue($group->getMinimumOrder());
     $customerGroup->setSurcharge($group->getMinimumOrderSurcharge());
     return $customerGroup;
 }