๐Ÿ‡ต๐Ÿ‡ฑPoland @jacek061192

Account created on 30 May 2019, over 5 years ago
#

Recent comments

๐Ÿ‡ต๐Ÿ‡ฑPoland jacek061192

I have already found the solution. It turned out the library was automatically added to Vendor each time the composer update was enabled. The only thing that needed to be done was deleting the library front Vendor. Everything is nรณw working properly. Thanks for your advice.

๐Ÿ‡ต๐Ÿ‡ฑPoland jacek061192

I have already found the solution. It turned out the library was automatically added to Vendor each time the composer update was enabled. The only thing that needed to be done was deleting the library front Vendor. Everything is nรณw working properly. Thanks for your advice.

๐Ÿ‡ต๐Ÿ‡ฑPoland jacek061192

I have already found the solution. It turned out the library was automatically added to Vendor each time the composer update was enabled. The only thing that needed to be done was deleting the library front Vendor. Everything is nรณw working properly. Thanks for your advice.

๐Ÿ‡ต๐Ÿ‡ฑPoland jacek061192

I deleted from Address module the library, v1.4.2. I used the command drush cr to rebuild cache. The library appeared again in the catalogue with new date, screenshot below. Unfortunately, it did not change anything. Is it possible that this library might be in another place? Because while installing Address module I didn't use Ludwig module. Everything was installed through composer.

๐Ÿ‡ต๐Ÿ‡ฑPoland jacek061192

Hi guys, thanks for quick response. Below you can find the whole code from the file. Indeed, it is different than the one in the repository https://github.com/commerceguys/addressing/blob/v1.4.2/src/Country/Count...

Below you can see the photo from Ludwig module.

Do you have any ideas how it can be fixed?

<?php

namespace Drupal\address\Repository;

use CommerceGuys\Addressing\Country\CountryRepository as ExternalCountryRepository;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Language\LanguageManagerInterface;

/**
 * Defines the country repository.
 *
 * Countries are stored on disk in JSON and cached inside Drupal.
 */
class CountryRepository extends ExternalCountryRepository {

  /**
   * The cache backend.
   *
   * @var \Drupal\Core\Cache\CacheBackendInterface
   */
  protected $cache;

  /**
   * Creates a CountryRepository instance.
   *
   * @param \Drupal\Core\Cache\CacheBackendInterface $cache
   *   The cache backend.
   * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
   *   The language manager.
   */
  public function __construct(CacheBackendInterface $cache, LanguageManagerInterface $language_manager) {
    parent::__construct();

    $this->cache = $cache;
    // The getCurrentLanguage() fallback is a workaround for core bug #2684873.
    $language = $language_manager->getConfigOverrideLanguage() ?: $language_manager->getCurrentLanguage();
    $this->defaultLocale = $language->getId();
  }

  /**
   * {@inheritdoc}
   */
  protected function loadDefinitions(string $locale): array {
    if (isset($this->definitions[$locale])) {
      return $this->definitions[$locale];
    }

    $cache_key = 'address.countries.' . $locale;
    if ($cached = $this->cache->get($cache_key)) {
      $this->definitions[$locale] = $cached->data;
    }
    else {
      $filename = $this->definitionPath . $locale . '.json';
      $this->definitions[$locale] = json_decode(file_get_contents($filename), TRUE);
      $this->cache->set($cache_key, $this->definitions[$locale], CacheBackendInterface::CACHE_PERMANENT, ['countries']);
    }

    return $this->definitions[$locale];
  }

}
Production build 0.71.5 2024