PHPackages                             it-bens/shopware-bool-to-yes-no-updater - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. it-bens/shopware-bool-to-yes-no-updater

ActivePackage

it-bens/shopware-bool-to-yes-no-updater
=======================================

Shopware package to update translations for boolean values to yes/no

v0.2.1(2y ago)01.3kMITPHPPHP ^8.1

Since Feb 5Pushed 2y ago1 watchersCompare

[ Source](https://github.com/it-bens/shopware-bool-to-yes-no-updater)[ Packagist](https://packagist.org/packages/it-bens/shopware-bool-to-yes-no-updater)[ RSS](/packages/it-bens-shopware-bool-to-yes-no-updater/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (10)Versions (5)Used By (0)

Shopware Bool To Yes/No Updater
===============================

[](#shopware-bool-to-yesno-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?
--------------------------

[](#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?
----------------------------------------------

[](#how-can-add-this-package-in-a-shopware-plugin)

First, the package has to be installed via composer:

```
composer require it-bens/shopware-bool-to-yes-no-updater
```

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

```
public function executeComposerCommands(): bool
{
    return true;
}
```

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.

```
use ITB\ShopwareBoolToYesNoUpdater\DependencyInjection\BoolToYesNoCompilerPass;

public function build(ContainerBuilder $container): void
{
    // ...
    parent::build($container);

    $container->addCompilerPass(new BoolToYesNoCompilerPass());
}
```

How can I use this package?
---------------------------

[](#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:

```
/** @var BoolToYesNoUpdaterInterface $boolToYesNoUpdater */
/** @var list $languages */
/** @var list $fields */
/** @var list $ids */

$boolToYesNoUpdater->update(
    $languages,
    $defaultLanguage,
    'entity_table',
    'entity_translation_table',
    ['field_1', 'field_2'],
    $ids
);
```

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.

```
/** @var AllLanguagesIdAndNameFetcherInterface $allLanguagesIdAndNameFetcher */
$allLanguagesIdAndNameFetcher->fetch();
```

```
/** @var EntityTranslationsLanguagesIdAndNameFetcherInterface $entityTranslationsLanguagesIdAndNameFetcher */
/** @var string $entityTable */
/** @var string $entityTranslationTable */
/** @var list $entityIds */

$entityTranslationsLanguagesIdAndNameFetcher->fetch(
    $entityTable,
    $entityTranslationTable,
    $entityIds
);
```

Default language and fallback 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
-----------------------------

[](#performance-and-indexer-loops)

The `BoolToYesNoUpdater` service is designed to be used in a [Shopware data indexer](https://developer.shopware.com/docs/guides/plugins/plugins/framework/data-handling/add-data-indexer.html). 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
------------

[](#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!

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~15 days

Total

4

Last Release

782d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/94aa1cc7aa38ca9d3f6bb96541ff813027df1f0cf478b3c53c41385876503b2c?d=identicon)[SpiGAndromeda](/maintainers/SpiGAndromeda)

---

Top Contributors

[![SpiGAndromeda](https://avatars.githubusercontent.com/u/15141351?v=4)](https://github.com/SpiGAndromeda "SpiGAndromeda (10 commits)")

---

Tags

shopwareshopware-plugin

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleECS

Type Coverage Yes

### Embed Badge

![Health badge](/badges/it-bens-shopware-bool-to-yes-no-updater/health.svg)

```
[![Health](https://phpackages.com/badges/it-bens-shopware-bool-to-yes-no-updater/health.svg)](https://phpackages.com/packages/it-bens-shopware-bool-to-yes-no-updater)
```

###  Alternatives

[shopware/storefront

Storefront for Shopware

684.2M148](/packages/shopware-storefront)[shopware/administration

Administration frontend for the Shopware Core

413.9M75](/packages/shopware-administration)[shopware/production

178190.0k](/packages/shopware-production)[frosh/tools

Provides some basic things for managing the Shopware Installation

79709.7k2](/packages/frosh-tools)[shopware/elasticsearch

Elasticsearch for Shopware

153.6M8](/packages/shopware-elasticsearch)[kiener/mollie-payments-plugin

Mollie Payments

6257.6k](/packages/kiener-mollie-payments-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
