/**
  * @return void
  */
 public function testPluginExpandsCartItemWithExpectedProductData()
 {
     $localeName = Store::getInstance()->getCurrentLocale();
     $localeTransfer = $this->localeFacade->getLocale($localeName);
     $taxRateEntity = new SpyTaxRate();
     $taxRateEntity->setRate(self::TAX_RATE_PERCENTAGE)->setName(self::TAX_RATE_NAME);
     $taxSetEntity = new SpyTaxSet();
     $taxSetEntity->addSpyTaxRate($taxRateEntity)->setName(self::TAX_SET_NAME);
     $productAbstractEntity = new SpyProductAbstract();
     $productAbstractEntity->setSpyTaxSet($taxSetEntity)->setAttributes('')->setSku(self::SKU_PRODUCT_ABSTRACT);
     $localizedAttributesEntity = new SpyProductLocalizedAttributes();
     $localizedAttributesEntity->setName(self::PRODUCT_CONCRETE_NAME)->setAttributes('')->setFkLocale($localeTransfer->getIdLocale());
     $productConcreteEntity = new SpyProduct();
     $productConcreteEntity->setSpyProductAbstract($productAbstractEntity)->setAttributes('')->addSpyProductLocalizedAttributes($localizedAttributesEntity)->setSku(self::SKU_PRODUCT_CONCRETE)->save();
     $changeTransfer = new CartChangeTransfer();
     $itemTransfer = new ItemTransfer();
     $itemTransfer->setSku(self::SKU_PRODUCT_CONCRETE);
     $changeTransfer->addItem($itemTransfer);
     $this->productCartConnectorFacade->expandItems($changeTransfer);
     $expandedItemTransfer = $changeTransfer->getItems()[0];
     $this->assertEquals(self::SKU_PRODUCT_ABSTRACT, $expandedItemTransfer->getAbstractSku());
     $this->assertEquals(self::SKU_PRODUCT_CONCRETE, $expandedItemTransfer->getSku());
     $this->assertEquals($productAbstractEntity->getIdProductAbstract(), $expandedItemTransfer->getIdProductAbstract());
     $this->assertEquals($productConcreteEntity->getIdProduct(), $expandedItemTransfer->getId());
 }
 /**
  * @param int $taxRate
  * @param string $iso2Code
  *
  * @return \Orm\Zed\Product\Persistence\SpyProductAbstract
  */
 protected function createAbstractProductWithTaxSet($taxRate, $iso2Code)
 {
     $countryEntity = SpyCountryQuery::create()->findOneByIso2Code($iso2Code);
     $taxRateEntity1 = new SpyTaxRate();
     $taxRateEntity1->setRate($taxRate);
     $taxRateEntity1->setName('test rate');
     $taxRateEntity1->setFkCountry($countryEntity->getIdCountry());
     $taxRateEntity1->save();
     $taxRateEntity2 = new SpyTaxRate();
     $taxRateEntity2->setRate(13);
     $taxRateEntity2->setName('test rate');
     $taxRateEntity2->setFkCountry($countryEntity->getIdCountry());
     $taxRateEntity2->save();
     $taxRateExemptEntity = new SpyTaxRate();
     $taxRateExemptEntity->setRate(0);
     $taxRateExemptEntity->setName(TaxConstants::TAX_EXEMPT_PLACEHOLDER);
     $taxRateExemptEntity->save();
     $taxSetEntity = new SpyTaxSet();
     $taxSetEntity->setName('name of tax set');
     $taxSetEntity->save();
     $taxSetTaxRateEntity = new SpyTaxSetTax();
     $taxSetTaxRateEntity->setFkTaxSet($taxSetEntity->getIdTaxSet());
     $taxSetTaxRateEntity->setFkTaxRate($taxRateEntity1->getIdTaxRate());
     $taxSetTaxRateEntity->save();
     $taxSetTaxRateEntity = new SpyTaxSetTax();
     $taxSetTaxRateEntity->setFkTaxSet($taxSetEntity->getIdTaxSet());
     $taxSetTaxRateEntity->setFkTaxRate($taxRateEntity2->getIdTaxRate());
     $taxSetTaxRateEntity->save();
     $taxSetTaxRateEntity = new SpyTaxSetTax();
     $taxSetTaxRateEntity->setFkTaxSet($taxSetEntity->getIdTaxSet());
     $taxSetTaxRateEntity->setFkTaxRate($taxRateExemptEntity->getIdTaxRate());
     $taxSetTaxRateEntity->save();
     $abstractProductEntity = new SpyProductAbstract();
     $abstractProductEntity->setSku('test-abstract-sku');
     $abstractProductEntity->setAttributes('');
     $abstractProductEntity->setFkTaxSet($taxSetEntity->getIdTaxSet());
     $abstractProductEntity->save();
     return $abstractProductEntity;
 }
 /**
  * @param int $taxRate
  * @param string $iso2Code
  *
  * @return \Orm\Zed\Shipment\Persistence\SpyShipmentMethod
  */
 protected function createShipmentMethodWithTaxSet($taxRate, $iso2Code)
 {
     $countryEntity = SpyCountryQuery::create()->findOneByIso2Code($iso2Code);
     $taxRateEntity1 = new SpyTaxRate();
     $taxRateEntity1->setRate($taxRate);
     $taxRateEntity1->setName('test rate 1');
     $taxRateEntity1->setFkCountry($countryEntity->getIdCountry());
     $taxRateEntity1->save();
     $taxRateEntity2 = new SpyTaxRate();
     $taxRateEntity2->setRate(13);
     $taxRateEntity2->setName('tax rate 2');
     $taxRateEntity2->setFkCountry($countryEntity->getIdCountry());
     $taxRateEntity2->save();
     $taxRateExemptEntity = new SpyTaxRate();
     $taxRateExemptEntity->setRate(0);
     $taxRateExemptEntity->setName(TaxConstants::TAX_EXEMPT_PLACEHOLDER);
     $taxRateExemptEntity->save();
     $taxSetEntity = new SpyTaxSet();
     $taxSetEntity->setName('name of tax set');
     $taxSetEntity->save();
     $taxSetTaxRateEntity = new SpyTaxSetTax();
     $taxSetTaxRateEntity->setFkTaxSet($taxSetEntity->getIdTaxSet());
     $taxSetTaxRateEntity->setFkTaxRate($taxRateEntity1->getIdTaxRate());
     $taxSetTaxRateEntity->save();
     $taxSetTaxRateEntity = new SpyTaxSetTax();
     $taxSetTaxRateEntity->setFkTaxSet($taxSetEntity->getIdTaxSet());
     $taxSetTaxRateEntity->setFkTaxRate($taxRateEntity2->getIdTaxRate());
     $taxSetTaxRateEntity->save();
     $taxSetTaxRateEntity = new SpyTaxSetTax();
     $taxSetTaxRateEntity->setFkTaxSet($taxSetEntity->getIdTaxSet());
     $taxSetTaxRateEntity->setFkTaxRate($taxRateExemptEntity->getIdTaxRate());
     $taxSetTaxRateEntity->save();
     $shipmentCarrierEntity = new SpyShipmentCarrier();
     $shipmentCarrierEntity->setName('name carrier');
     $shipmentCarrierEntity->save();
     $shipmentMethodEntity = new SpyShipmentMethod();
     $shipmentMethodEntity->setFkShipmentCarrier($shipmentCarrierEntity->getIdShipmentCarrier());
     $shipmentMethodEntity->setFkTaxSet($taxSetEntity->getIdTaxSet());
     $shipmentMethodEntity->setName('test shipment method');
     $shipmentMethodEntity->save();
     return $shipmentMethodEntity;
 }
Example #4
0
 /**
  * @return \Orm\Zed\Tax\Persistence\SpyTaxSet
  */
 private function loadFixtures()
 {
     $taxRateEntity = new SpyTaxRate();
     $taxRateEntity->setName(self::DUMMY_TAX_RATE1_NAME);
     $taxRateEntity->setRate(self::DUMMY_TAX_RATE1_PERCENTAGE);
     $taxRateEntity->save();
     $taxSetEntity = new SpyTaxSet();
     $taxSetEntity->setName(self::DUMMY_TAX_SET_NAME);
     $taxSetEntity->addSpyTaxRate($taxRateEntity);
     $taxSetEntity->save();
     return $taxSetEntity;
 }
Example #5
0
 /**
  * @group Product
  *
  * @return void
  */
 public function testGetProductConcrete()
 {
     $localeName = Store::getInstance()->getCurrentLocale();
     $localeTransfer = $this->localeFacade->getLocale($localeName);
     $taxRateEntity = new SpyTaxRate();
     $taxRateEntity->setRate(self::TAX_RATE_PERCENTAGE)->setName(self::TAX_RATE_NAME);
     $taxSetEntity = new SpyTaxSet();
     $taxSetEntity->addSpyTaxRate($taxRateEntity)->setName(self::TAX_SET_NAME);
     $productAbstractEntity = new SpyProductAbstract();
     $productAbstractEntity->setSpyTaxSet($taxSetEntity)->setAttributes('')->setSku(self::SKU_PRODUCT_ABSTRACT);
     $localizedAttributesEntity = new SpyProductLocalizedAttributes();
     $localizedAttributesEntity->setName(self::PRODUCT_CONCRETE_NAME)->setAttributes('')->setFkLocale($localeTransfer->getIdLocale());
     $productConcreteEntity = new SpyProduct();
     $productConcreteEntity->setSpyProductAbstract($productAbstractEntity)->setAttributes('')->addSpyProductLocalizedAttributes($localizedAttributesEntity)->setSku(self::SKU_PRODUCT_CONCRETE)->save();
     $productConcreteTransfer = $this->productFacade->getProductConcrete($productConcreteEntity->getSku());
     $this->assertEquals(self::PRODUCT_CONCRETE_NAME, $productConcreteTransfer->getName());
     $this->assertEquals(self::SKU_PRODUCT_CONCRETE, $productConcreteTransfer->getSku());
     $this->assertEquals(self::SKU_PRODUCT_ABSTRACT, $productConcreteTransfer->getProductAbstractSku());
     $this->assertEquals($productConcreteEntity->getIdProduct(), $productConcreteTransfer->getIdProductConcrete());
     $this->assertEquals($productAbstractEntity->getIdProductAbstract(), $productConcreteTransfer->getIdProductAbstract());
 }
 /**
  * @return array
  */
 public static function loadFixtures()
 {
     $ids = [];
     $dbConnection = Propel::getConnection();
     $taxRateEntity = new SpyTaxRate();
     $taxRateEntity->setRate(10)->setName('Foo');
     $taxRateEntity->save();
     $ids['idTaxRate1'] = $taxRateEntity->getIdTaxRate();
     $taxRateEntity = new SpyTaxRate();
     $taxRateEntity->setRate(5)->setName('Bar');
     $taxRateEntity->save();
     $ids['idTaxRate2'] = $taxRateEntity->getIdTaxRate();
     $taxSetEntity = new SpyTaxSet();
     $taxSetEntity->setName('Baz');
     $taxSetEntity->save();
     $ids['idTaxSet'] = $taxSetEntity->getIdTaxSet();
     $taxSetTaxEntity = new SpyTaxSetTax();
     $taxSetTaxEntity->setFkTaxSet($ids['idTaxSet'])->setFkTaxRate($ids['idTaxRate1']);
     $taxSetTaxEntity->save();
     $taxSetTaxEntity = new SpyTaxSetTax();
     $taxSetTaxEntity->setFkTaxSet($ids['idTaxSet'])->setFkTaxRate($ids['idTaxRate2']);
     $taxSetTaxEntity->save();
     $productAbstractEntity = new SpyProductAbstract();
     $productAbstractEntity->setSku('ABC123')->setFkTaxSet($ids['idTaxSet'])->setAttributes('{}');
     $productAbstractEntity->save();
     $ids['idProductAbstract'] = $productAbstractEntity->getIdProductAbstract();
     $productEntity = new SpyProduct();
     $productEntity->setSku('DEF456')->setFkProductAbstract($ids['idProductAbstract'])->setAttributes('{}');
     $productEntity->save();
     $ids['idProductConcrete'] = $productEntity->getIdProduct();
     $productOptionTypeEntity = new SpyProductOptionType();
     $productOptionTypeEntity->save();
     $ids['idTypeColor'] = $productOptionTypeEntity->getIdProductOptionType();
     $productOptionTypeEntity = new SpyProductOptionType();
     $productOptionTypeEntity->setFkTaxSet($ids['idTaxSet']);
     $productOptionTypeEntity->save();
     $ids['idTypeSize'] = $productOptionTypeEntity->getIdProductOptionType();
     $productOptionValueEntity = new SpyProductOptionValue();
     $productOptionValueEntity->setFkProductOptionType($ids['idTypeColor']);
     $productOptionValueEntity->save();
     $ids['idValueRed'] = $productOptionValueEntity->getIdProductOptionValue();
     $productOptionValueEntity = new SpyProductOptionValue();
     $productOptionValueEntity->setFkProductOptionType($ids['idTypeColor']);
     $productOptionValueEntity->save();
     $ids['idValueBlue'] = $productOptionValueEntity->getIdProductOptionValue();
     $productOptionValueEntity = new SpyProductOptionValue();
     $productOptionValueEntity->setFkProductOptionType($ids['idTypeColor']);
     $productOptionValueEntity->save();
     $ids['idValueGreen'] = $productOptionValueEntity->getIdProductOptionValue();
     $productOptionValueEntity = new SpyProductOptionValue();
     $productOptionValueEntity->setFkProductOptionType($ids['idTypeColor']);
     $productOptionValueEntity->save();
     $ids['idValueYellow'] = $productOptionValueEntity->getIdProductOptionValue();
     $productOptionValuePriceEntity = new SpyProductOptionValuePrice();
     $productOptionValuePriceEntity->setPrice(199);
     $productOptionValuePriceEntity->save();
     $ids['idPriceLarge'] = $productOptionValuePriceEntity->getIdProductOptionValuePrice();
     $productOptionValueEntity = new SpyProductOptionValue();
     $productOptionValueEntity->setFkProductOptionType($ids['idTypeSize'])->setFkProductOptionValuePrice($ids['idPriceLarge']);
     $productOptionValueEntity->save();
     $ids['idValueLarge'] = $productOptionValueEntity->getIdProductOptionValue();
     $productOptionValueEntity = new SpyProductOptionValue();
     $productOptionValueEntity->setFkProductOptionType($ids['idTypeSize']);
     $productOptionValueEntity->save();
     $ids['idValueSmall'] = $productOptionValueEntity->getIdProductOptionValue();
     $productOptionValueEntity = new SpyProductOptionValue();
     $productOptionValueEntity->setFkProductOptionType($ids['idTypeSize']);
     $productOptionValueEntity->save();
     $ids['idValueMedium'] = $productOptionValueEntity->getIdProductOptionValue();
     $productOptionValueEntity = new SpyProductOptionValue();
     $productOptionValueEntity->setFkProductOptionType($ids['idTypeSize']);
     $productOptionValueEntity->save();
     $ids['idValueXSmall'] = $productOptionValueEntity->getIdProductOptionValue();
     $localeEntity = new SpyLocale();
     $localeEntity->setLocaleName('xx_XX');
     $localeEntity->save();
     $ids['idLocale'] = $localeEntity->getIdLocale();
     $productOptionTypeTranslationEntity = new SpyProductOptionTypeTranslation();
     $productOptionTypeTranslationEntity->setName('Size')->setFkLocale($ids['idLocale'])->setFkProductOptionType($ids['idTypeSize']);
     $productOptionTypeTranslationEntity->save();
     $productOptionTypeTranslationEntity = new SpyProductOptionTypeTranslation();
     $productOptionTypeTranslationEntity->setName('Color')->setFkLocale($ids['idLocale'])->setFkProductOptionType($ids['idTypeColor']);
     $productOptionTypeTranslationEntity->save();
     $data = ['Blue' => $ids['idValueBlue'], 'Red' => $ids['idValueRed'], 'Yellow' => $ids['idValueYellow'], 'Green' => $ids['idValueGreen'], 'Large' => $ids['idValueLarge'], 'Medium' => $ids['idValueMedium'], 'Small' => $ids['idValueSmall'], 'Extra' => $ids['idValueXSmall']];
     foreach ($data as $name => $fkProductOptionValue) {
         $productOptionValueTranslationEntity = new SpyProductOptionValueTranslation();
         $productOptionValueTranslationEntity->setName($name)->setFkLocale($ids['idLocale'])->setFkProductOptionValue($fkProductOptionValue);
         $productOptionValueTranslationEntity->save();
     }
     $productOptionTypeUsageEntity = new SpyProductOptionTypeUsage();
     $productOptionTypeUsageEntity->setIsOptional(0)->setSequence(1)->setFkProduct($ids['idProductConcrete'])->setFkProductOptionType($ids['idTypeColor']);
     $productOptionTypeUsageEntity->save();
     $ids['idUsageColor'] = $productOptionTypeUsageEntity->getIdProductOptionTypeUsage();
     $productOptionTypeUsageEntity = new SpyProductOptionTypeUsage();
     $productOptionTypeUsageEntity->setIsOptional(0)->setSequence(1)->setFkProduct($ids['idProductConcrete'])->setFkProductOptionType($ids['idTypeSize']);
     $productOptionTypeUsageEntity->save();
     $ids['idUsageSize'] = $productOptionTypeUsageEntity->getIdProductOptionTypeUsage();
     $productOptionValueUsageEntity = new SpyProductOptionValueUsage();
     $productOptionValueUsageEntity->setSequence(1)->setFkProductOptionValue($ids['idValueBlue'])->setFkProductOptionTypeUsage($ids['idUsageColor']);
     $productOptionValueUsageEntity->save();
     $ids['idUsageBlue'] = $productOptionValueUsageEntity->getIdProductOptionValueUsage();
     $productOptionValueUsageEntity = new SpyProductOptionValueUsage();
     $productOptionValueUsageEntity->setSequence(2)->setFkProductOptionValue($ids['idValueRed'])->setFkProductOptionTypeUsage($ids['idUsageColor']);
     $productOptionValueUsageEntity->save();
     $ids['idUsageRed'] = $productOptionValueUsageEntity->getIdProductOptionValueUsage();
     $productOptionValueUsageEntity = new SpyProductOptionValueUsage();
     $productOptionValueUsageEntity->setSequence(3)->setFkProductOptionValue($ids['idValueYellow'])->setFkProductOptionTypeUsage($ids['idUsageColor']);
     $productOptionValueUsageEntity->save();
     $ids['idUsageYellow'] = $productOptionValueUsageEntity->getIdProductOptionValueUsage();
     $productOptionValueUsageEntity = new SpyProductOptionValueUsage();
     $productOptionValueUsageEntity->setSequence(4)->setFkProductOptionValue($ids['idValueGreen'])->setFkProductOptionTypeUsage($ids['idUsageColor']);
     $productOptionValueUsageEntity->save();
     $ids['idUsageGreen'] = $productOptionValueUsageEntity->getIdProductOptionValueUsage();
     $productOptionValueUsageEntity = new SpyProductOptionValueUsage();
     $productOptionValueUsageEntity->setSequence(1)->setFkProductOptionValue($ids['idValueLarge'])->setFkProductOptionTypeUsage($ids['idUsageSize']);
     $productOptionValueUsageEntity->save();
     $ids['idUsageLarge'] = $productOptionValueUsageEntity->getIdProductOptionValueUsage();
     $productOptionValueUsageEntity = new SpyProductOptionValueUsage();
     $productOptionValueUsageEntity->setSequence(2)->setFkProductOptionValue($ids['idValueMedium'])->setFkProductOptionTypeUsage($ids['idUsageSize']);
     $productOptionValueUsageEntity->save();
     $ids['idUsageMedium'] = $productOptionValueUsageEntity->getIdProductOptionValueUsage();
     $productOptionValueUsageEntity = new SpyProductOptionValueUsage();
     $productOptionValueUsageEntity->setSequence(3)->setFkProductOptionValue($ids['idValueSmall'])->setFkProductOptionTypeUsage($ids['idUsageSize']);
     $productOptionValueUsageEntity->save();
     $ids['idUsageSmall'] = $productOptionValueUsageEntity->getIdProductOptionValueUsage();
     $productOptionValueUsageEntity = new SpyProductOptionValueUsage();
     $productOptionValueUsageEntity->setSequence(4)->setFkProductOptionValue($ids['idValueXSmall'])->setFkProductOptionTypeUsage($ids['idUsageSize']);
     $productOptionValueUsageEntity->save();
     $ids['idUsageXSmall'] = $productOptionValueUsageEntity->getIdProductOptionValueUsage();
     $productOptionTypeUsageExclusionEntity = new SpyProductOptionTypeUsageExclusion();
     $productOptionTypeUsageExclusionEntity->setFkProductOptionTypeUsageA($ids['idUsageColor'])->setFkProductOptionTypeUsageB($ids['idUsageSize']);
     $productOptionTypeUsageExclusionEntity->save();
     $productOptionValueUsageConstraintEntity = new SpyProductOptionValueUsageConstraint();
     $productOptionValueUsageConstraintEntity->setFkProductOptionValueUsageA($ids['idUsageBlue'])->setFkProductOptionValueUsageB($ids['idUsageSmall'])->setOperator('NOT');
     $productOptionValueUsageConstraintEntity->save();
     $productOptionValueUsageConstraintEntity = new SpyProductOptionValueUsageConstraint();
     $productOptionValueUsageConstraintEntity->setFkProductOptionValueUsageA($ids['idUsageRed'])->setFkProductOptionValueUsageB($ids['idUsageMedium'])->setOperator('ALWAYS');
     $productOptionValueUsageConstraintEntity->save();
     $productOptionValueUsageConstraintEntity = new SpyProductOptionValueUsageConstraint();
     $productOptionValueUsageConstraintEntity->setFkProductOptionValueUsageA($ids['idUsageGreen'])->setFkProductOptionValueUsageB($ids['idUsageSmall'])->setOperator('ALLOW');
     $productOptionValueUsageConstraintEntity->save();
     $productOptionValueUsageConstraintEntity = new SpyProductOptionValueUsageConstraint();
     $productOptionValueUsageConstraintEntity->setFkProductOptionValueUsageA($ids['idUsageGreen'])->setFkProductOptionValueUsageB($ids['idUsageLarge'])->setOperator('ALLOW');
     $productOptionValueUsageConstraintEntity->save();
     $productOptionConfigurationPresetEntity = new SpyProductOptionConfigurationPreset();
     $productOptionConfigurationPresetEntity->setIsDefault(true)->setSequence(1)->setFkProduct($ids['idProductConcrete']);
     $productOptionConfigurationPresetEntity->save();
     $ids['idConfigPresetA'] = $productOptionConfigurationPresetEntity->getIdProductOptionConfigurationPreset();
     $productOptionConfigurationPresetEntity = new SpyProductOptionConfigurationPreset();
     $productOptionConfigurationPresetEntity->setIsDefault(false)->setSequence(2)->setFkProduct($ids['idProductConcrete']);
     $productOptionConfigurationPresetEntity->save();
     $ids['idConfigPresetB'] = $productOptionConfigurationPresetEntity->getIdProductOptionConfigurationPreset();
     $data = [$ids['idUsageRed'] => $ids['idConfigPresetA'], $ids['idUsageMedium'] => $ids['idConfigPresetA'], $ids['idUsageGreen'] => $ids['idConfigPresetB'], $ids['idUsageLarge'] => $ids['idConfigPresetB']];
     foreach ($data as $fkProductOptionValueUsage => $fkProductOptionConfigurationPreset) {
         $productOptionConfigurationPresetValueEntity = new SpyProductOptionConfigurationPresetValue();
         $productOptionConfigurationPresetValueEntity->setFkProductOptionConfigurationPreset($fkProductOptionConfigurationPreset)->setFkProductOptionValueUsage($fkProductOptionValueUsage);
         $productOptionConfigurationPresetValueEntity->save();
     }
     return $ids;
 }
 /**
  * @return void
  */
 private function loadFixtures()
 {
     $rate1 = new SpyTaxRate();
     $rate1->setName('Rate1')->setRate(10)->save();
     $this->taxRateIds[] = $rate1->getIdTaxRate();
     $rate2 = new SpyTaxRate();
     $rate2->setName('Rate2')->setRate(5)->save();
     $this->taxRateIds[] = $rate2->getIdTaxRate();
     $taxSet = new SpyTaxSet();
     $taxSet->setName('Set1')->addSpyTaxRate($rate1)->addSpyTaxRate($rate2)->save();
     $this->taxSetId = $taxSet->getIdTaxSet();
     $product1 = new SpyProductAbstract();
     $product1->setSku('Product1')->setSpyTaxSet($taxSet)->setAttributes('{}')->save();
     $this->productAbstractIds[] = $product1->getIdProductAbstract();
     $product2 = new SpyProductAbstract();
     $product2->setSku('Product2')->setSpyTaxSet($taxSet)->setAttributes('{}')->save();
     $this->productAbstractIds[] = $product2->getIdProductAbstract();
 }
Example #8
0
 /**
  * @param \Generated\Shared\Transfer\TaxRateTransfer $taxRateTransfer
  *
  * @return \Orm\Zed\Tax\Persistence\SpyTaxRate
  */
 private function createTaxRateEntity(TaxRateTransfer $taxRateTransfer)
 {
     $taxRateEntity = new SpyTaxRate();
     $taxRateEntity->fromArray($taxRateTransfer->toArray());
     if ($taxRateTransfer->getFkCountry() === 0) {
         $taxRateEntity->setFkCountry(null);
     }
     $taxRateEntity->save();
     return $taxRateEntity;
 }
Example #9
0
 /**
  * @param \Orm\Zed\Tax\Persistence\SpyTaxRate $taxRateEntity
  *
  * @return string
  */
 protected function getCountryName(SpyTaxRate $taxRateEntity)
 {
     $countryName = self::COUNTRY_NOT_AVAILABLE;
     if ($taxRateEntity->getCountry()) {
         $countryName = $taxRateEntity->getCountry()->getName();
     }
     return $countryName;
 }