/** * @return void */ protected function deletePriceEntitiesConcrete($requestProduct) { SpyPriceProductQuery::create()->filterByProduct($requestProduct)->delete(); }
/** * @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(); }
/** * @return \Orm\Zed\Price\Persistence\SpyPriceProductQuery */ public function createPriceProductQuery() { return SpyPriceProductQuery::create(); }