Author: Kamil Kokot (kamil.kokot@lakion.com)
Inheritance: extends Sylius\Bundle\CoreBundle\Fixture\AbstractResourceFixture
Ejemplo n.º 1
0
 /**
  * {@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 = [];
     for ($i = 0; $i < $options['amount']; ++$i) {
         $products[] = ['name' => sprintf('Sticker "%s"', $this->faker->word), 'code' => $this->faker->uuid, 'main_taxon' => 'stickers', 'taxons' => ['stickers'], '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'])], 'images' => ['main' => sprintf('%s/../Resources/fixtures/%s', __DIR__, 'stickers.jpg'), 'thumbnail' => sprintf('%s/../Resources/fixtures/%s', __DIR__, 'stickers.jpg')]];
     }
     $this->productFixture->load(['custom' => $products]);
 }
Ejemplo n.º 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 = [];
     for ($i = 0; $i < $options['amount']; ++$i) {
         $products[] = ['name' => sprintf('Mug "%s"', $this->faker->word), 'code' => $this->faker->uuid, 'main_taxon' => 'mugs', 'taxons' => ['mugs'], 'product_attributes' => ['mug_material' => $this->faker->randomElement(['Invisible porcelain', 'Banana skin', 'Porcelain', 'Centipede'])], 'images' => [sprintf('%s/../Resources/fixtures/%s', __DIR__, 'mugs.jpg')]];
     }
     $this->productFixture->load(['custom' => $products]);
 }
Ejemplo n.º 3
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 = [];
     for ($i = 0; $i < $options['amount']; ++$i) {
         $name = $this->faker->name;
         $products[] = ['name' => sprintf('Book "%s" by %s', $this->faker->word, $name), 'code' => $this->faker->uuid, 'main_taxon' => 'books', 'taxons' => ['books'], 'product_attributes' => ['BOOK-AUTHOR' => $name, 'BOOK-ISBN' => $this->faker->isbn13, 'BOOK-PAGES' => $this->faker->numberBetween(42, 1024)], 'images' => [sprintf('%s/../Resources/fixtures/%s', __DIR__, 'books.jpg')]];
     }
     $this->productFixture->load(['custom' => $products]);
 }
Ejemplo n.º 4
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', 'children' => [['code' => 'mens_t_shirts', 'name' => 'Men'], ['code' => 'womens_t_shirts', 'name' => '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 = [];
     for ($i = 0; $i < $options['amount']; ++$i) {
         $categoryTaxonCode = $this->faker->randomElement(['mens_t_shirts', 'womens_t_shirts']);
         $products[] = ['name' => sprintf('T-Shirt "%s"', $this->faker->word), 'code' => $this->faker->uuid, 'main_taxon' => $categoryTaxonCode, 'taxons' => [$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]);
 }
Ejemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 public function load(array $options)
 {
     $options = $this->optionsResolver->resolve($options);
     $taxons = [];
     if (null === $this->taxonRepository->findOneBy(['code' => 'CATEGORY'])) {
         $taxons[] = ['name' => 'Category', 'code' => 'CATEGORY', 'parent' => null];
     }
     if (null === $this->taxonRepository->findOneBy(['code' => 'BRAND'])) {
         $taxons[] = ['name' => 'Brand', 'code' => 'BRAND', 'parent' => null];
     }
     $this->taxonFixture->load(['custom' => array_merge($taxons, [['name' => 'Mugs', 'code' => 'MUGS', 'parent' => 'CATEGORY'], ['name' => 'Mugland', 'code' => 'MUGLAND', 'parent' => 'BRAND']])]);
     $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']]]]);
     $this->productArchetypeFixture->load(['custom' => [['name' => 'Mug', 'code' => 'MUG', 'product_attributes' => ['MUG-MATERIAL'], 'product_options' => ['MUG-TYPE']]]]);
     $products = [];
     for ($i = 0; $i < $options['amount']; ++$i) {
         $products[] = ['name' => sprintf('Mug "%s"', $this->faker->word), 'code' => $this->faker->uuid, 'main_taxon' => 'MUGS', 'product_archetype' => 'MUG', 'taxons' => ['MUGS', 'MUGLAND'], 'product_attributes' => ['MUG-MATERIAL' => $this->faker->randomElement(['Invisible porcelain', 'Banana skin', 'Porcelain', 'Centipede'])], 'images' => [sprintf('%s/../Resources/fixtures/%s', __DIR__, 'mugs.jpg')]];
     }
     $this->productFixture->load(['custom' => $products]);
 }
Ejemplo n.º 6
0
 /**
  * {@inheritdoc}
  */
 public function load(array $options)
 {
     $options = $this->optionsResolver->resolve($options);
     $taxons = [];
     if (null === $this->taxonRepository->findOneBy(['code' => 'CATEGORY'])) {
         $taxons[] = ['name' => 'Category', 'code' => 'CATEGORY', 'parent' => null];
     }
     if (null === $this->taxonRepository->findOneBy(['code' => 'BRAND'])) {
         $taxons[] = ['name' => 'Brand', 'code' => 'BRAND', 'parent' => null];
     }
     $this->taxonFixture->load(['custom' => array_merge($taxons, [['name' => 'T-Shirts', 'code' => 'TSHIRTS', 'parent' => 'CATEGORY'], ['name' => 'Super Tees', 'code' => 'SUPER-TEES', 'parent' => 'BRAND']])]);
     $this->productAttributeFixture->load(['custom' => [['name' => 'T-Shirt brand', 'code' => 'TSHIRT-BRAND', 'type' => TextAttributeType::TYPE], ['name' => 'T-Shirt collection', 'code' => 'TSHIRT-COLLECTION', 'type' => TextAttributeType::TYPE], ['name' => 'T-Shirt material', 'code' => 'TSHIRT-MATERIAL', 'type' => TextAttributeType::TYPE]]]);
     $this->productOptionFixture->load(['custom' => [['name' => 'T-Shirt color', 'code' => 'TSHIRT-COLOR', 'values' => ['TSHIRT-COLOR-RED' => 'Red', 'TSHIRT-COLOR-BLACK' => 'Black', 'TSHIRT-COLOR-WHITE' => 'White']], ['name' => 'T-Shirt size', 'code' => 'TSHIRT-SIZE', 'values' => ['TSHIRT-SIZE-S' => 'S', 'TSHIRT-SIZE-M' => 'M', 'TSHIRT-SIZE-L' => 'L', 'TSHIRT-SIZE-XL' => 'XL', 'TSHIRT-SIZE-XXL' => 'XXL']]]]);
     $this->productArchetypeFixture->load(['custom' => [['name' => 'T-Shirt', 'code' => 'TSHIRT', 'product_attributes' => ['TSHIRT-BRAND', 'TSHIRT-COLLECTION', 'TSHIRT-MATERIAL'], 'product_options' => ['TSHIRT-COLOR', 'TSHIRT-SIZE']]]]);
     $products = [];
     for ($i = 0; $i < $options['amount']; ++$i) {
         $products[] = ['name' => sprintf('T-Shirt "%s"', $this->faker->word), 'code' => $this->faker->uuid, 'main_taxon' => 'TSHIRTS', 'product_archetype' => 'TSHIRT', 'taxons' => ['TSHIRTS', 'SUPER-TEES'], 'product_attributes' => ['TSHIRT-BRAND' => $this->faker->randomElement(['Nike', 'Adidas', 'JKM-476 Streetwear', 'Potato', 'Centipede Wear']), 'TSHIRT-COLLECTION' => sprintf('Sylius %s %s', $this->faker->randomElement(['Summer', 'Winter', 'Spring', 'Autumn']), mt_rand(1995, 2012)), 'TSHIRT-MATERIAL' => $this->faker->randomElement(['Centipede', 'Wool', 'Centipede 10% / Wool 90%', 'Potato 100%'])], 'images' => [sprintf('%s/../Resources/fixtures/%s', __DIR__, 't-shirts.jpg')]];
     }
     $this->productFixture->load(['custom' => $products]);
 }
Ejemplo n.º 7
0
 /**
  * {@inheritdoc}
  */
 public function load(array $options)
 {
     $options = $this->optionsResolver->resolve($options);
     $taxons = [];
     if (null === $this->taxonRepository->findOneBy(['code' => 'CATEGORY'])) {
         $taxons[] = ['name' => 'Category', 'code' => 'CATEGORY', 'parent' => null];
     }
     if (null === $this->taxonRepository->findOneBy(['code' => 'BRAND'])) {
         $taxons[] = ['name' => 'Brand', 'code' => 'BRAND', 'parent' => null];
     }
     $this->taxonFixture->load(['custom' => array_merge($taxons, [['name' => 'Books', 'code' => 'BOOKS', 'parent' => 'CATEGORY'], ['name' => 'BookMania', 'code' => 'BOOKMANIA', 'parent' => 'BRAND']])]);
     $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]]]);
     $this->productArchetypeFixture->load(['custom' => [['name' => 'Book', 'code' => 'BOOK', 'product_attributes' => ['BOOK-AUTHOR', 'BOOK-ISBN', 'BOOK-PAGES'], 'product_options' => []]]]);
     $products = [];
     for ($i = 0; $i < $options['amount']; ++$i) {
         $name = $this->faker->name;
         $products[] = ['name' => sprintf('Book "%s" by %s', $this->faker->word, $name), 'code' => $this->faker->uuid, 'main_taxon' => 'BOOKS', 'product_archetype' => 'BOOK', 'taxons' => ['BOOKS', 'BOOKMANIA'], 'product_attributes' => ['BOOK-AUTHOR' => $name, 'BOOK-ISBN' => $this->faker->isbn13, 'BOOK-PAGES' => $this->faker->numberBetween(42, 1024)], 'images' => [sprintf('%s/../Resources/fixtures/%s', __DIR__, 'books.jpg')]];
     }
     $this->productFixture->load(['custom' => $products]);
 }
Ejemplo n.º 8
0
 /**
  * {@inheritdoc}
  */
 public function load(array $options)
 {
     $options = $this->optionsResolver->resolve($options);
     $taxons = [];
     if (null === $this->taxonRepository->findOneBy(['code' => 'CATEGORY'])) {
         $taxons[] = ['name' => 'Category', 'code' => 'CATEGORY', 'parent' => null];
     }
     if (null === $this->taxonRepository->findOneBy(['code' => 'BRAND'])) {
         $taxons[] = ['name' => 'Brand', 'code' => 'BRAND', 'parent' => null];
     }
     $this->taxonFixture->load(['custom' => array_merge($taxons, [['name' => 'Stickers', 'code' => 'STICKERS', 'parent' => 'CATEGORY'], ['name' => 'StickyPicky', 'code' => 'STICKYPICKY', 'parent' => 'BRAND']])]);
     $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"']]]]);
     $this->productArchetypeFixture->load(['custom' => [['name' => 'Sticker', 'code' => 'STICKER', 'product_attributes' => ['STICKER-PAPER', 'STICKER-RESOLUTION'], 'product_options' => ['STICKER-SIZE']]]]);
     $products = [];
     for ($i = 0; $i < $options['amount']; ++$i) {
         $products[] = ['name' => sprintf('Sticker "%s"', $this->faker->word), 'code' => $this->faker->uuid, 'main_taxon' => 'STICKERS', 'product_archetype' => 'STICKER', 'taxons' => ['STICKERS', 'STICKYPICKY'], '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'])], 'images' => [sprintf('%s/../Resources/fixtures/%s', __DIR__, 'stickers.jpg')]];
     }
     $this->productFixture->load(['custom' => $products]);
 }