The fixture plugin is really helpful if you want to create some static demo data for your shopware instance.

Last update: Aug 8, 2022

Fixture Plugin

The fixture plugin is really helpful if you want to create some static demo data for your shopware instance.

Installation

Just add it to your project via composer: "composer require basecom/sw6-fixtures-plugin" (or add entry in psh dependency).

Create Fixtures

  1. Create a new file in the specific folder of your project for the fixtures.
  2. Extend this file from abstract class "Fixture" in the library.
  3. Implement the "load()" method with fixture logic
  4. Optional: Add a priority or dependency of other Fixture classes via the corresponding "dependsOn()" or "priority()" method.
  5. If you want to run specific fixtures as a group later, implement the "groups()" method from the abstact class and return an array of strings as group names.

Run the fixtures

  • To run a single fixture, use the command "**bin/console fixture:load:single " with Fixture name as parameter.
    • E.g. fixture class is named "DummyFixture.php", run **bin/console fixture:load:single dummyFixture (it´s case-insensitive).
  • To run a group of fixture, run "bin/console fixture:load:group " with group name as parameter (specified via groups() method). It´s also case-insensitive.
  • To run all fixtures, run "bin/console fixture:load".

Start developing

This template uses a full-featured Dockware docker image. It already comes with a pre-installed Shopware 6 instance and everything you need to start developing.

Please see the Dockware documentation.

To start developing, simply start the container:

> docker compose up -d

Access the container:

> make shell

Install the dependencies and make everything ready (defined in composer.json and package.json). This command needs to be executed from the host-system (not in shell)

> make install

Linting

Before committing, please run the linting and static analysis tools. This command also needs to be executed from the host machine (not in shell):

> make lint

GitLab pipeline

The GitLab pipeline is already pre-configured. It contains multiple jobs for all linting, static analysis and testing tools.

The pipeline runs all tests for the latest stable Shopware 6 version. But you have several options for the PHPUnit tests:

GitHub

https://github.com/basecom/FixturesPlugin
You might also like...

This demo app shows you how to run a simple PHP application on AWS Elastic Beanstalk.

Elastic Beanstalk + PHP Demo App - "Share Your Thoughts" This demo app shows you how to run a simple PHP application on AWS Elastic Beanstalk. Run the

Jul 12, 2022

Cheatsheet for some Php knowledge you will frequently encounter in modern projects.

Cheatsheet for some Php knowledge you will frequently encounter in modern projects.

Cheatsheet for some Php knowledge you will frequently encounter in modern projects.

Aug 7, 2022

Ratio plugin is a luck plugin. The more lucky you are, the more you win!

Ratio plugin is a luck plugin. The more lucky you are, the more you win!

Ratio Ratio plugin is a luck plugin. The more lucky you are, the more you win Features When you break a block (Cobblestone), it gives/puts you somethi

Apr 25, 2022

⚡️ A WordPress plugin to quickly send a 404 for missing static files

Static 404 A WordPress plugin to quickly send a 404 for missing static files. Quickly output a 404 for static files that aren't found, rather than loa

Mar 2, 2022

A useful PocketMine-MP plugin that allows you to create crates in-game!

ComplexCrates A useful PocketMine-MP plugin that allows you to create crates in-game! Commands Main command: /crate Sub commands: create

Aug 26, 2021

This plugin allows you to create many-to-many relationships between pages in Kirby and synchronizes them on both sides.

This plugin allows you to create many-to-many relationships between pages in Kirby and synchronizes them on both sides.

Kirby 3 Many To Many Field This plugin allows you to create many-to-many relationships between pages in Kirby.

Jul 1, 2022

WP Local Analytics plugin. - run user analytics within your system and track user data inside your database.

WP Local Analytics plugin. - run user analytics within your system and track user data inside your database.

Jul 11, 2022
Comments
  • 1. NTR: Add Media Upload Helper

    proposal pull request, please check if you like it

    building a media upload helper to automatically insert local assets from the fixture folder as cover images or other media

    $this->helper->Media()->upload(
        self::MEDIA_ID,
        $this->helper->getMediaDefaultFolderId('product'),
         __DIR__ . '/Assets/voucher-product.png',
        'png',
        'image/png',
    );
    
    Screen Shot 2022-07-27 at 23 48 02
    Reviewed by boxblinkracer at 2022-07-27 21:51
  • 2. NTR: Add getCategoryIdByName in Helper class

    With the Shopware Demo data I wasn't able to easily display a product in the storefront, because the provided helper functions lead to root-level categories that where somehow not displayed.

    I've created a getCategoryByName which turned out to work and is easy to use. Would be cool if that could be added.

    $id = $this->helper->getCategoryIdByName('Clothing');

    Reviewed by boxblinkracer at 2022-07-26 14:29
  • 3. SUGGESTION – Swap license to MIT

    I personally like the MIT license for open source packages less restricting and often times used (Dockware for example is also MIT licensed).

    What do you guys think? I'm fine with keeping the Apache license, but I thought I will make the suggestion, because I would like MIT better 😅

    @jdambacher If you don't want to change the license, feel free to close this MR.

    Thanks

    Reviewed by jkniest at 2022-08-03 20:11
  • 4. NTR: improve README with instructions and best practices

    review notes

    I've added some visual concepts to the readme, like code snippets and paragraphs

    also, i figured out some kind of best practice for plugin development. used it in a plugin of mine. could you verify it? the benefit is to avoid fixtures from being accidentally loaded when the plugin only has production dependencies :)

    Reviewed by boxblinkracer at 2022-07-26 15:52
🌏 Webnux 🌏 , a videos streaming website where you can watch what you want when you want.
🌏 Webnux 🌏 , a videos streaming website where you can watch what you want when you want.

?? WEBNUX ?? Welcome to ?? Webnux ?? , a videos streaming website where you can watch what you want when you want. ☀️ ☀️ OBJECTIFS ☀️ ☀️ - A sessi

Dec 3, 2021
Silverstripe module allowing editors to create newsletters using elemental blocks and export them to a sendy instance

Silverstripe Sendy Silverstripe module allowing editors to create newsletters using elemental blocks and export them to a sendy instance. Introduction

Apr 20, 2022
Do you want CronJob to follow the solar date?You need this package to solve this problem.
Do you want CronJob to follow the solar date?You need this package to solve this problem.

Shamsic Maybe it happened to you that you wanted to use CronJob in your project and you realized that you cannot manage the exact dates that are in th

Jul 19, 2022
Greyhole uses Samba to create a storage pool of all your available hard drives, and allows you to create redundant copies of the files you store.

Greyhole Greyhole is an application that uses Samba to create a storage pool of all your available hard drives (whatever their size, however they're c

Aug 6, 2022
Nextcloud AIO stands for Nextcloud All In One and provides easy deployment and maintenance with most features included in this one Nextcloud instance.

Nextcloud All In One Beta This is beta software and not production ready. But feel free to use it at your own risk! We expect there to be rough edges

Aug 14, 2022
PHP package to make your objects strict and throw exception when you try to access or set some undefined property in your objects.

?? Yell PHP package to make your objects strict and throw exception when you try to access or set some undefined property in your objects. Requirement

Dec 8, 2018
Composer registry manager that help to easily switch to the composer repository you want

CRM - Composer Registry Manager Composer Registry Manager can help you easily and quickly switch between different composer repositories. 简体中文 Install

Aug 8, 2022
Create eye-catching Open Graph images for each (or some) site pages
Create eye-catching Open Graph images for each (or some) site pages

Open Graph Image Generator for Laravel Create Open Graph images (og:image, twitter:image, vk:image) for each (or some) site pages. Use page title to c

Jun 30, 2022