PHP code example of it-bens / shopware-bool-to-yes-no-updater

1. Go to this page and download the library: Download it-bens/shopware-bool-to-yes-no-updater library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

it-bens / shopware-bool-to-yes-no-updater example snippets


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

use ITB\ShopwareBoolToYesNoUpdater\DependencyInjection\BoolToYesNoCompilerPass;

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

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

/** @var BoolToYesNoUpdaterInterface $boolToYesNoUpdater */
/** @var list<array{id: string, name: string}> $languages */
/** @var list<string> $fields */
/** @var list<string> $ids */

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

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

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

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