majerome/sylius-workshop-plugin

Majerome workshop plugin for Sylius.


README

Sylius Packagist Version Packagist Downloads Maintenance License

Sylius

Sylius Practical Mastery Course

Chapter 25.2 - How to create a Plugin

Chapter 26.3 - How to upgrade plugin to 1.14

This plugin is the product of Sylius training. It allows you to add a custom “Brand” resource, with those features :

  • Back Office Grid: creation, edition, deletion,
  • Assignment to a category "automotive" or "electronics.",
  • Workflow for brand validation by State Machine,
  • Association brands-products, and listing of branded products.

Installation (Docker)

Notes:

  • 1st tested on a Sylius v1.13 Docker Project
  • Then tested on a Sylius v1.14 Docker Project
  • Finally tested on a Sylius v2.0 Docker Project
  • Make sure you're running a correctly installed version of the Sylius Docker project, and that you've performed all the necessary migrations beforehand.
  1. Get the plugin from Composer

    docker compose exec php composer require majerome/sylius-workshop-plugin --no-scripts
    

    Note:

    Depending on your Sylius version, you need to specify the appropriate version of the plugin:

    • For Sylius v1.13, use majerome/sylius-workshop-plugin:1.0.7
    • For Sylius v1.14, use majerome/sylius-workshop-plugin:1.1.3
  2. Apply the git patch to set up the plugin:

    git apply vendor/majerome/sylius-workshop-plugin/src/Installer/majerome-workshop-plugin-sylius-2.0.patch
    

    Notes:

    • You can revert that patch using majerome-workshop-plugin-sylius-2.0-reverse.patch file instead
    • If you are using a Sylius v1.13 project, replace the patch file with majerome-workshop-plugin-sylius-1.13.patch.
      (reverse patch is majerome-workshop-plugin-sylius-1.13-reverse.patch)
    • If you are using a Sylius v1.14 project, replace the patch file with majerome-workshop-plugin-sylius-1.14.patch.
      (reverse patch is majerome-workshop-plugin-sylius-1.14-reverse.patch)
  3. Get into the php container and flush the cache:

    make php-shell
    

    Then run:

    bin/console cache:clear
    
  4. Generate the migrations:

    bin/console doctrine:migrations:diff
    

    Note: Choose namespace [0] App\Migrations.

  5. Run the migration

    bin/console doctrine:migrations:migrate
    
  6. Load the fixtures:

    bin/console sylius:fixtures:load -n
    
  7. Clear the cache to handle translations

    bin/console cache:clear
    
  8. Play with your brand new 'Brand' resource!

Releases

  • v1.0.7 - Valid version for Sylius v1.13
  • v1.1.3 - Valid version for Sylius v1.14
  • v1.2.1 - Valid version for Sylius v2.0

Screenshots

  • Sylius v1

Demo

  • Sylius v2

Demo