shopsys/read-model

[experimental] Read model layer for Shopsys Framework

v13.0.0 2023-10-11 20:08 UTC

This package is auto-updated.

Last update: 2024-11-07 13:54:22 UTC


README

Downloads

This bundle for Shopsys Framework separates templates from model using read model concept. The bundle is dedicated for projects based on Shopsys Framework (i.e. created from shopsys/project-base) exclusively.

This repository is maintained by shopsys/shopsys monorepo, information about changes is in monorepo CHANGELOG.md.

Installation

The plugin is a Symfony bundle and is installed in the same way:

Download

First, you download the package using Composer:

composer require shopsys/read-model

Register

For the bundle to be loaded in your application you need to register it in registerBundles() method in the app/AppKernel.php file of your project:

+ new Shopsys\ReadModelBundle\ShopsysReadModelBundle(),

Usage

If you want to leverage the advantages of read model concept, you need to use the particular implementation of ListedProductViewFacadeInterface in your controllers (there is already prepared one implementation in the bundle). The facade provides you the view objects for product lists that can be then used in the templates.

Available View Objects

  • ListedProductView - product representation for FE product lists
  • ActionView - representation of product action area (i.e. form for adding a product to cart, or link to the product detail in the case of main variant)
  • ImageView - representation of image

Available Twig functions

  • image - renders image from given ImageView

Contributing

Thank you for your contributions to Shopsys Read Model package. Together we are making Shopsys Framework better.

This repository is READ-ONLY. If you want to report issues and/or send pull requests, please use the main Shopsys repository.

Please, check our Contribution Guide before contributing.

Support

What to do when you are in troubles or need some help? The best way is to join our Slack.

If you want to report issues, please use the main Shopsys repository.