Ejemplo n.º 1
0
 /**
  * @param Product $product
  */
 private function saveStores(Product $product)
 {
     if ($product->isStoresModified()) {
         $this->getDb()->query("DELETE FROM product_to_store WHERE product_id = :productId", [':productId' => $product->getId()]);
         foreach ($product->getStores() as $store) {
             $this->getDb()->query("\n                    INSERT INTO product_to_store\n                    SET\n                        product_id = :productId,\n                        store_id = :storeId\n                    ", [':productId' => $product->getId(), ':storeId' => $store]);
         }
     }
 }