Download the PHP package it-bens/shopware-bool-to-yes-no-updater without Composer

On this page you can find all versions of the php package it-bens/shopware-bool-to-yes-no-updater. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package shopware-bool-to-yes-no-updater

Shopware Bool To Yes/No Updater

A lot of Shopware entities support translations. The translated fields are stored inside entity translation tables.

This package provides the ability to transform boolean entity fields into "translated booleans" like "Yes" and "No". These translated fields can come in handy if a boolean field should shown in a storefront.

Is this a Shopware Plugin?

No. While this package is tied to Shopware, it won't react on any events on it's own. It is meant to be used by a Shopware plugin.

How can add this package in a Shopware plugin?

First, the package has to be installed via composer:

This can be done in the plugin's composer.json file. But don't forget to enable composer in the plugin class.

This package provides a Symfony compiler pass that will add all the services to the Shopware plugin service container. It can be added to the plugin's build method.

How can I use this package?

The actual work is done by the BoolToYesNoUpdater service. It should be injected into the desired service via the BoolToYesNoUpdaterInterface. The update method will create an SQL update query that will writes the boolean-translations into given translation table. The boolean value is taken from en entity table and a defined list of fields. The method also requires a list of languages which should be considered and a list of entity IDs that should be updated.

The usage could look like this:

The language information looks a little strange but it can be fetched with services from this package. The AllLanguagesIdAndNameFetcher just returns a list of all language IDs and names, that are installed in Shopware. The EntityTranslationsLanguagesIdAndNameFetcher returns a list of language IDs and names based on the actual existent entity translations.

Default language and fallback translations

This package uses the it-bens/simple-words-translator. It provides translations for some languages but of cause not for all languages in the world ... or that are known to Shopware. That's why a default language can be defined. If a translation is not found for a language by it's name, the default language will be used instead.

Furthermore, a default value can be defined for all table entries that should be updated because the entity id was passed, but contains not valid boolean value for the given field. The most convenient default value is null.

Performance and Indexer loops

The BoolToYesNoUpdater service is designed to be used in a Shopware data indexer. To improve the performance and to prevent loop calls by triggering the DAL, the updater uses only plain SQL code and no higher abstractions. However, the queries are executed on a doctrine connection, so the queries should still be safe.

Contributing

I am really happy that the software developer community loves Open Source, like I do! ♥

That's why I appreciate every issue that is opened (preferably constructive) and every pull request that provides other or even better code to this package.

You are all breathtaking!


All versions of shopware-bool-to-yes-no-updater with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
it-bens/simple-words-translator Version ^0.2
shopware/core Version ^6.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package it-bens/shopware-bool-to-yes-no-updater contains the following files

Loading the files please wait ....