コード例 #1
0
ファイル: WriterTest.php プロジェクト: spryker/Price
 /**
  * @return void
  */
 protected function setTestData()
 {
     $priceType1 = SpyPriceTypeQuery::create()->filterByName(self::DUMMY_PRICE_TYPE_1)->findOneOrCreate();
     $priceType1->setName(self::DUMMY_PRICE_TYPE_1)->save();
     $priceType2 = SpyPriceTypeQuery::create()->filterByName(self::DUMMY_PRICE_TYPE_2)->findOneOrCreate();
     $priceType2->setName(self::DUMMY_PRICE_TYPE_2)->save();
     $productAbstract = SpyProductAbstractQuery::create()->filterBySku(self::DUMMY_SKU_PRODUCT_ABSTRACT)->findOne();
     if ($productAbstract === null) {
         $productAbstract = new SpyProductAbstract();
     }
     $productAbstract->setSku(self::DUMMY_SKU_PRODUCT_ABSTRACT)->setAttributes('{}')->save();
     $productConcrete = SpyProductQuery::create()->filterBySku(self::DUMMY_SKU_PRODUCT_CONCRETE)->findOne();
     if ($productConcrete === null) {
         $productConcrete = new SpyProduct();
     }
     $productConcrete->setSku(self::DUMMY_SKU_PRODUCT_CONCRETE)->setAttributes('{}')->setSpyProductAbstract($productAbstract)->save();
     $this->deletePriceEntitiesConcrete($productConcrete);
     $productConcrete->setSku(self::DUMMY_SKU_PRODUCT_CONCRETE)->setAttributes('{}')->setSpyProductAbstract($productAbstract)->save();
     $this->deletePriceEntitiesAbstract($productAbstract);
 }
コード例 #2
0
ファイル: CartFacadeTest.php プロジェクト: spryker/Cart
 /**
  * @return void
  */
 protected function setTestData()
 {
     $defaultPriceType = SpyPriceTypeQuery::create()->filterByName(self::PRICE_TYPE_DEFAULT)->findOneOrCreate();
     $defaultPriceType->setName(self::PRICE_TYPE_DEFAULT)->save();
     $abstractProduct1 = SpyProductAbstractQuery::create()->filterBySku(self::DUMMY_1_SKU_ABSTRACT_PRODUCT)->findOneOrCreate();
     $abstractProduct1->setSku(self::DUMMY_1_SKU_ABSTRACT_PRODUCT)->setAttributes('{}')->save();
     $concreteProduct1 = SpyProductQuery::create()->filterBySku(self::DUMMY_1_SKU_CONCRETE_PRODUCT)->findOneOrCreate();
     $concreteProduct1->setSku(self::DUMMY_1_SKU_CONCRETE_PRODUCT)->setSpyProductAbstract($abstractProduct1)->setAttributes('{}')->save();
     $abstractProduct2 = SpyProductAbstractQuery::create()->filterBySku(self::DUMMY_2_SKU_ABSTRACT_PRODUCT)->findOneOrCreate();
     $abstractProduct2->setSku(self::DUMMY_2_SKU_ABSTRACT_PRODUCT)->setAttributes('{}')->save();
     $concreteProduct2 = SpyProductQuery::create()->filterBySku(self::DUMMY_2_SKU_CONCRETE_PRODUCT)->findOneOrCreate();
     $concreteProduct2->setSku(self::DUMMY_2_SKU_CONCRETE_PRODUCT)->setSpyProductAbstract($abstractProduct2)->setAttributes('{}')->save();
     SpyPriceProductQuery::create()->filterByProduct($concreteProduct1)->filterBySpyProductAbstract($abstractProduct1)->filterByPriceType($defaultPriceType)->findOneOrCreate()->setPrice(100)->save();
     SpyPriceProductQuery::create()->filterByProduct($concreteProduct2)->filterBySpyProductAbstract($abstractProduct2)->filterByPriceType($defaultPriceType)->findOneOrCreate()->setPrice(100)->save();
 }
コード例 #3
0
 /**
  * @return \Orm\Zed\Price\Persistence\SpyPriceTypeQuery
  */
 public function createPriceTypeQuery()
 {
     return SpyPriceTypeQuery::create();
 }