/**
  * {@inheritdoc}
  */
 public function load(array $options)
 {
     $options = $this->optionsResolver->resolve($options);
     $this->taxonFixture->load(['custom' => [['code' => 'category', 'name' => 'Category', 'children' => [['code' => 'stickers', 'name' => 'Stickers']]]]]);
     $this->productAttributeFixture->load(['custom' => [['name' => 'Sticker paper', 'code' => 'sticker_paper', 'type' => TextAttributeType::TYPE], ['name' => 'Sticker resolution', 'code' => 'sticker_resolution', 'type' => TextAttributeType::TYPE]]]);
     $this->productOptionFixture->load(['custom' => [['name' => 'Sticker size', 'code' => 'sticker_size', 'values' => ['sticker_size-3' => '3"', 'sticker_size_5' => '5"', 'sticker_size_7' => '7"']]]]);
     $products = [];
     $productsNames = $this->getUniqueNames($options['amount']);
     for ($i = 0; $i < $options['amount']; ++$i) {
         $products[] = ['name' => sprintf('Sticker "%s"', $productsNames[$i]), 'code' => $this->faker->uuid, 'main_taxon' => 'stickers', 'taxons' => ['stickers'], 'variant_selection_method' => ProductInterface::VARIANT_SELECTION_CHOICE, 'product_attributes' => ['sticker_paper' => sprintf('Paper from tree %s', $this->faker->randomElement(['Wung', 'Tanajno', 'Lemon-San', 'Me-Gusta'])), 'sticker_resolution' => $this->faker->randomElement(['JKM XD', '476DPI', 'FULL HD', '200DPI'])], 'product_options' => ['sticker_size'], 'images' => ['main' => sprintf('%s/../Resources/fixtures/%s', __DIR__, 'stickers.jpg'), 'thumbnail' => sprintf('%s/../Resources/fixtures/%s', __DIR__, 'stickers.jpg')]];
     }
     $this->productFixture->load(['custom' => $products]);
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function load(array $options)
 {
     $options = $this->optionsResolver->resolve($options);
     $this->taxonFixture->load(['custom' => [['code' => 'category', 'name' => 'Category', 'children' => [['code' => 'mugs', 'name' => 'Mugs']]]]]);
     $this->productAttributeFixture->load(['custom' => [['name' => 'Mug material', 'code' => 'mug_material', 'type' => TextAttributeType::TYPE]]]);
     $this->productOptionFixture->load(['custom' => [['name' => 'Mug type', 'code' => 'mug_type', 'values' => ['mug_type_medium' => 'Medium mug', 'mug_type_double' => 'Double mug', 'mug_type_monster' => 'Monster mug']]]]);
     $products = [];
     $productsNames = $this->getUniqueNames($options['amount']);
     for ($i = 0; $i < $options['amount']; ++$i) {
         $products[] = ['name' => sprintf('Mug "%s"', $productsNames[$i]), 'code' => $this->faker->uuid, 'main_taxon' => 'mugs', 'taxons' => ['mugs'], 'product_attributes' => ['mug_material' => $this->faker->randomElement(['Invisible porcelain', 'Banana skin', 'Porcelain', 'Centipede'])], 'product_options' => ['mug_type'], 'images' => ['main' => sprintf('%s/../Resources/fixtures/%s', __DIR__, 'mugs.jpg'), 'thumbnail' => sprintf('%s/../Resources/fixtures/%s', __DIR__, 'mugs.jpg')]];
     }
     $this->productFixture->load(['custom' => $products]);
 }
 /**
  * {@inheritdoc}
  */
 public function load(array $options)
 {
     $options = $this->optionsResolver->resolve($options);
     $this->productAssociationTypeFixture->load(['custom' => [['code' => 'similar_products', 'name' => 'Similar products']]]);
     $products = $this->productRepository->findAll();
     $products = $this->faker->randomElements($products, $options['amount']);
     $productAssociations = [];
     /** @var ProductInterface $product */
     foreach ($products as $product) {
         $productAssociations[] = ['type' => 'similar_products', 'owner' => $product->getCode(), 'associated_products' => $this->getAssociatedProductsAsArray($product)];
     }
     $this->productAssociationFixture->load(['custom' => $productAssociations]);
 }
Beispiel #4
0
 /**
  * {@inheritdoc}
  */
 public function load(array $options)
 {
     $options = $this->optionsResolver->resolve($options);
     $this->taxonFixture->load(['custom' => [['code' => 'category', 'name' => 'Category', 'children' => [['code' => 'books', 'name' => 'Books']]]]]);
     $this->productAttributeFixture->load(['custom' => [['name' => 'Book author', 'code' => 'book_author', 'type' => TextAttributeType::TYPE], ['name' => 'Book ISBN', 'code' => 'book_isbn', 'type' => TextAttributeType::TYPE], ['name' => 'Book pages', 'code' => 'book_pages', 'type' => IntegerAttributeType::TYPE]]]);
     $products = [];
     $productsNames = $this->getUniqueNames($options['amount']);
     for ($i = 0; $i < $options['amount']; ++$i) {
         $authorName = $this->faker->name;
         $products[] = ['name' => sprintf('Book "%s" by %s', $productsNames[$i], $authorName), 'code' => $this->faker->uuid, 'main_taxon' => 'books', 'taxons' => ['books'], 'product_attributes' => ['book_author' => $authorName, 'book_isbn' => $this->faker->isbn13, 'book_pages' => $this->faker->numberBetween(42, 1024)], 'images' => ['main' => sprintf('%s/../Resources/fixtures/%s', __DIR__, 'books.jpg'), 'thumbnail' => sprintf('%s/../Resources/fixtures/%s', __DIR__, 'books.jpg')]];
     }
     $this->productFixture->load(['custom' => $products]);
 }
Beispiel #5
0
 /**
  * {@inheritdoc}
  */
 public function load(array $options)
 {
     $options = $this->optionsResolver->resolve($options);
     $this->taxonFixture->load(['custom' => [['code' => 'category', 'name' => 'Category', 'children' => [['code' => 't_shirts', 'name' => 'T-Shirts', 'slug' => 't-shirts', 'children' => [['code' => 'mens_t_shirts', 'name' => 'Men', 'slug' => 't-shirts/men'], ['code' => 'womens_t_shirts', 'name' => 'Women', 'slug' => 't-shirts/women']]]]]]]);
     $this->productAttributeFixture->load(['custom' => [['name' => 'T-Shirt brand', 'code' => 't_shirt_brand', 'type' => TextAttributeType::TYPE], ['name' => 'T-Shirt collection', 'code' => 't_shirt_collection', 'type' => TextAttributeType::TYPE], ['name' => 'T-Shirt material', 'code' => 't_shirt_material', 'type' => TextAttributeType::TYPE]]]);
     $this->productOptionFixture->load(['custom' => [['name' => 'T-Shirt color', 'code' => 't_shirt_color', 'values' => ['t_shirt_color_red' => 'Red', 't_shirt_color_black' => 'Black', 't_shirt_color_white' => 'White']], ['name' => 'T-Shirt size', 'code' => 't_shirt_size', 'values' => ['t_shirt_size_s' => 'S', 't_shirt_size_m' => 'M', 't_shirt_size_l' => 'L', 't_shirt_size_xl' => 'XL', 't_shirt_size_xxl' => 'XXL']]]]);
     $products = [];
     $productsNames = $this->getUniqueNames($options['amount']);
     for ($i = 0; $i < $options['amount']; ++$i) {
         $categoryTaxonCode = $this->faker->randomElement(['mens_t_shirts', 'womens_t_shirts']);
         $products[] = ['name' => sprintf('T-Shirt "%s"', $productsNames[$i]), 'code' => $this->faker->uuid, 'main_taxon' => $categoryTaxonCode, 'taxons' => ['t_shirts', $categoryTaxonCode], 'product_attributes' => ['t_shirt_brand' => $this->faker->randomElement(['Nike', 'Adidas', 'JKM-476 Streetwear', 'Potato', 'Centipede Wear']), 't_shirt_collection' => sprintf('Sylius %s %s', $this->faker->randomElement(['Summer', 'Winter', 'Spring', 'Autumn']), mt_rand(1995, 2012)), 't_shirt_material' => $this->faker->randomElement(['Centipede', 'Wool', 'Centipede 10% / Wool 90%', 'Potato 100%'])], 'product_options' => ['t_shirt_color', 't_shirt_size'], 'images' => ['main' => sprintf('%s/../Resources/fixtures/%s', __DIR__, 't-shirts.jpg'), 'thumbnail' => sprintf('%s/../Resources/fixtures/%s', __DIR__, 't-shirts.jpg')]];
     }
     $this->productFixture->load(['custom' => $products]);
 }
 /**
  * @param ObjectManager $objectManager
  * @param ExampleFactoryInterface $exampleFactory
  * @param array $attributeTypes
  */
 public function __construct(ObjectManager $objectManager, ExampleFactoryInterface $exampleFactory, array $attributeTypes)
 {
     parent::__construct($objectManager, $exampleFactory);
     $this->attributeTypes = array_keys($attributeTypes);
 }
 /**
  * {@inheritdoc}
  */
 public function load(array $options)
 {
     $this->productReviewFixture->load(['random' => $options['amount']]);
 }