Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Translatable] Adding Translatable on existing entity doesn't seems to work #2682

Closed
Zhortein opened this issue Aug 22, 2023 · 3 comments
Closed

Comments

@Zhortein
Copy link

Environment

Package

show

$ composer show --latest gedmo/doctrine-extensions
Info from https://repo.packagist.org: #StandWithUkraine
name     : gedmo/doctrine-extensions
descrip. : Doctrine behavioral extensions
keywords : Blameable, behaviors, doctrine, extensions, gedmo, loggable, nestedset, odm, orm, sluggable, sortable, timestampable, translatable, tree, uploadable
versions : * v3.12.0
latest   : v3.12.0
type     : library
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
homepage : http://gediminasm.org/
source   : [git] https://github.com/doctrine-extensions/DoctrineExtensions.git eef4b4978118fdb4c0a03509325e807ad96e3bec
dist     : [zip] https://api.github.com/repos/doctrine-extensions/DoctrineExtensions/zipball/eef4b4978118fdb4c0a03509325e807ad96e3bec eef4b4978118fdb4c0a03509325e807ad96e3bec
path     : P:\DEVZONE\GPS\NcManager\vendor\gedmo\doctrine-extensions
names    : gedmo/doctrine-extensions

support
email : [email protected]
issues : https://github.com/doctrine-extensions/DoctrineExtensions/issues
source : https://github.com/doctrine-extensions/DoctrineExtensions/tree/v3.12.0
wiki : https://github.com/Atlantic18/DoctrineExtensions/tree/main/doc

autoload
psr-4
Gedmo\ => src/

requires
behat/transliterator ~1.2
doctrine/annotations ^1.13 || ^2.0
doctrine/collections ^1.2 || ^2.0
doctrine/common ^2.13 || ^3.0
doctrine/event-manager ^1.2 || ^2.0
doctrine/persistence ^2.2 || ^3.0
php ^7.2 || ^8.0
psr/cache ^1 || ^2 || ^3
symfony/cache ^4.4 || ^5.3 || ^6.0
symfony/deprecation-contracts ^2.1 || ^3.0

requires (dev)
doctrine/cache ^1.11 || ^2.0
doctrine/dbal ^2.13.1 || ^3.2
doctrine/doctrine-bundle ^2.3
doctrine/mongodb-odm ^2.3
doctrine/orm ^2.10.2
friendsofphp/php-cs-fixer ^3.4.0 <3.10
nesbot/carbon ^2.55
phpstan/phpstan ^1.10.2
phpstan/phpstan-doctrine ^1.0
phpstan/phpstan-phpunit ^1.0
phpunit/phpunit ^8.5 || ^9.5
rector/rector ^0.15.20
symfony/console ^4.4 || ^5.3 || ^6.0
symfony/phpunit-bridge ^6.0
symfony/yaml ^4.4 || ^5.3 || ^6.0

suggests
doctrine/mongodb-odm to use the extensions with the MongoDB ODM
doctrine/orm to use the extensions with the ORM

conflicts
doctrine/dbal <2.13.1 || ^3.0 <3.2
doctrine/mongodb-odm <2.3
doctrine/orm <2.10.2
sebastian/comparator <2.0

Doctrine packages

show

$ composer show --latest 'doctrine/*'
Color legend:
- patch or minor release available - update recommended
- major release available - update possible
- up to date version

Direct dependencies required in composer.json:
doctrine/annotations                2.0.1  2.0.1  Docblock Annotations Parser
doctrine/doctrine-bundle            2.10.2 2.10.2 Symfony DoctrineBundle
doctrine/doctrine-fixtures-bundle   3.4.4  3.4.4  Symfony DoctrineFixturesBundle
doctrine/doctrine-migrations-bundle 3.2.4  3.2.4  Symfony DoctrineMigrationsBundle
doctrine/orm                        2.16.1 2.16.1 Object-Relational-Mapper for PHP

Transitive dependencies not required in composer.json:
doctrine/cache                      2.2.0  2.2.0  PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.
doctrine/collections                2.1.3  2.1.3  PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.
doctrine/common                     3.4.3  3.4.3  PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflection support, proxies and much more.
doctrine/data-fixtures              1.6.7  1.6.7  Data Fixtures for all Doctrine Object Managers
doctrine/dbal                       3.6.6  3.6.6  Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.
doctrine/deprecations               v1.1.1 v1.1.1 A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.
doctrine/event-manager              2.0.0  2.0.0  The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.
doctrine/inflector                  2.0.8  2.0.8  PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.
doctrine/instantiator               2.0.0  2.0.0  A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                      2.1.0  3.0.0  PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
doctrine/migrations                 3.6.0  3.6.0  PHP Doctrine Migrations project offer additional functionality on top of the database abstraction layer (DBAL) for versioning your database schema and easily deploying changes to it. It is a very easy to use and a powerful ...  
doctrine/persistence                3.2.0  3.2.0  The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.
doctrine/sql-formatter              1.1.3  1.1.3  a PHP SQL highlighting library

PHP version

$ php -v
PHP 8.2.9 (cli) (built: Aug  1 2023 12:35:15) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.2.9, Copyright (c) Zend Technologies

Subject

I have a Symfony 6.3.3 application with entities. Some of them use Translatable without any problem. I tried to add Translatable on an existing entity called "Country". This Country entity didn't use Translatable when i first created it. So i've added Translatable interface to my entity, add use stetements for using Gedmo, mark a field as Translatable via attributes, add the Gedmo/Locale to a new attribute and the setTranslatableLocale function like in my pther translatable entities which works well.

When i used in a service some code to persist some Country entities with their translations in my PostgreSQL 14 database, i've got the following error :

An exception occurred in the driver: SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "abstract_translation_id_seq" does not exist
CONTEXT:  unnamed portal parameter $1 = '...'

None of my entites defined some custom TranslationEntities. I've tried to define one without any success. I've also tried to empty doctrine cache with the following commands still without success :

php bin/console doctrine:cache:clear-metadata
php bin/console doctrine:cache:clear-query
php bin/console doctrine:cache:clear-result

I've also tried to force schema update, but still no change.

Minimal repository with the bug

Steps to reproduce

Expected results

Inserting translations into the Translatable default table or in the table defined for the targetted entity.

Actual results

Extract of code which produce the error :

$translatableRepository = $this->doctrine->getRepository(Translation::class);
foreach ($jsonData as $data) {
                $isNew = false;
                $country = $this->doctrine->getRepository(Country::class)->findOneBy(['codeNum' => $data['numericCode']]);
                if (null === $country) {
                    $country = new Country();
                    $country->setCodeNum((int) $data['numericCode']);
                    $isNew = true;
                } elseif (!$update) {
                    continue;
                }

                $country->setName($data['name']);
                $country->setIso2(trim($data['alpha2Code']));
                $country->setIso3(trim($data['alpha3Code']));
                $country->setFlagIcon(strtolower('fi fi-'.trim($data['alpha2Code'])));
                $country->setCapital($data['capital'] ?? null);
                $country->setPopulation($data['population'] ?? null);
                if ($isNew) {
                    $this->doctrine->getManager()->persist($country);
                }

                foreach ($data['translations'] as $langIso2 => $translation) {
                    $this->doctrine->getManager()->flush();
                    $translatableRepository->translate($country, 'name', $langIso2, $translation);
                }

              
            }

            $this->doctrine->getManager()->flush();

Country entity code :

<?php

namespace App\Entity\Geo;

use App\Entity\NcManager\Currency;
use App\Entity\NcManager\Customer;
use App\Entity\NcManager\EndUser;
use App\Entity\NcManager\Location;
use App\Entity\Traits\CommonEntityFieldsTrait;
use App\Entity\Traits\DatasourceTrait;
use App\Entity\Translation\CountryTranslation;
use App\Repository\Geo\CountryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Translatable\Translatable;
use Symfony\Component\Validator\Constraints as Assert;

// @todo Ajouter les drapeaux
#[ORM\Entity(repositoryClass: CountryRepository::class)]
#[ORM\Table(name: 'geo_country', options: ['comment' => 'Represent a country'])]
#[ORM\Index(columns: ['source_id'], name: 'country_sourceid_idx',
    options: [
        'where' => '((source_id IS NOT NULL))',
    ])]
#[Gedmo\TranslationEntity(class: CountryTranslation::class)]
class Country implements Translatable
{
    use CommonEntityFieldsTrait;
    use DatasourceTrait;

    /**
     * Used locale to override Translation listener`s locale
     * this is not a mapped field of entity metadata, just a simple property.
     */
    #[Gedmo\Locale]
    private string $locale = 'en';

    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column(type: Types::INTEGER, options: ['comment' => 'Internal unique identifier'])]
    private ?int $id = null;

    #[ORM\Column(type: Types::STRING, length: 255, options: ['comment' => 'Name'])]
    #[Assert\NotBlank]
    #[Assert\Length(min: 2, max: 255)]
    #[Gedmo\Translatable]
    private ?string $name = null;

    #[ORM\Column(type: Types::STRING, length: 64, nullable: true, options: ['comment' => 'Prefix to use for this country'])]
    #[Assert\NotBlank]
    #[Assert\Length(max: 64)]
    private ?string $prefix = null;

    #[ORM\Column(type: Types::STRING, length: 2, options: ['comment' => 'ISO2 code'])]
    #[Assert\NotBlank]
    #[Assert\Length(min: 2, max: 2)]
    private ?string $iso2 = null;

    #[ORM\Column(type: Types::STRING, length: 3, options: ['comment' => 'ISO3 code'])]
    #[Assert\NotBlank]
    #[Assert\Length(min: 3, max: 3)]
    private ?string $iso3 = null;

    #[ORM\Column(type: Types::INTEGER, options: ['comment' => 'Numeric code'])]
    #[Assert\NotBlank]
    #[Assert\GreaterThanOrEqual(0)]
    private ?int $codeNum = null;

    #[ORM\Column(type: Types::INTEGER, nullable: true, options: ['comment' => 'Numerical geo code'])]
    #[Assert\GreaterThanOrEqual(0)]
    private ?int $geoCodeNum = null;

    #[ORM\OneToMany(mappedBy: 'country', targetEntity: Customer::class)]
    private Collection $customers;

    #[ORM\OneToMany(mappedBy: 'country', targetEntity: EndUser::class)]
    private Collection $endUsers;

    #[ORM\OneToMany(mappedBy: 'country', targetEntity: Location::class)]
    private Collection $locations;

    #[ORM\Column(length: 255, nullable: true, options: ['comment' => 'Name of the country in SAP'])]
    #[Assert\Length(max: 255)]
    private ?string $sapCountryName = null;

    #[ORM\ManyToMany(targetEntity: GeoArea::class, mappedBy: 'countries')]
    private Collection $geoAreas;

    #[ORM\Column(length: 255, nullable: true, options: ['comment' => 'Flag icon class'])]
    #[Assert\Length(max: 255)]
    private ?string $flagIcon = null;

    #[ORM\Column(length: 255, nullable: true, options: ['comment' => 'English name of the capital'])]
    #[Assert\Length(max: 255)]
    private ?string $capital = null;

    #[ORM\Column(nullable: true, options: ['comment' => 'Population'])]
    #[Assert\PositiveOrZero]
    private ?int $population = null;

    #[ORM\ManyToMany(targetEntity: Currency::class, mappedBy: 'countries')]
    private Collection $currencies;

    public function __construct()
    {
        $this->customers = new ArrayCollection();
        $this->endUsers = new ArrayCollection();
        $this->locations = new ArrayCollection();
        $this->geoAreas = new ArrayCollection();
        $this->currencies = new ArrayCollection();
    }

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getName(): ?string
    {
        return $this->name;
    }

    public function setName(string $name): self
    {
        $this->name = $name;

        return $this;
    }

    public function getPrefix(): ?string
    {
        return $this->prefix;
    }

    public function setPrefix(?string $prefix): self
    {
        $this->prefix = $prefix;

        return $this;
    }

    public function getIso2(): ?string
    {
        return $this->iso2;
    }

    public function setIso2(?string $iso2): self
    {
        $this->iso2 = $iso2;

        return $this;
    }

    public function getIso3(): ?string
    {
        return $this->iso3;
    }

    public function setIso3(?string $iso3): self
    {
        $this->iso3 = $iso3;

        return $this;
    }

    public function getCodeNum(): ?int
    {
        return $this->codeNum;
    }

    public function setCodeNum(?int $codeNum): self
    {
        $this->codeNum = $codeNum;

        return $this;
    }

    public function getGeoCodeNum(): ?int
    {
        return $this->geoCodeNum;
    }

    public function setGeoCodeNum(?int $geoCodeNum): self
    {
        $this->geoCodeNum = $geoCodeNum;

        return $this;
    }

    public function getText(): string
    {
        return $this->getName();
    }

    /**
     * @return Collection<int, Customer>
     */
    public function getCustomers(): Collection
    {
        return $this->customers;
    }

    public function addCustomer(Customer $customer): static
    {
        if (!$this->customers->contains($customer)) {
            $this->customers->add($customer);
            $customer->setCountry($this);
        }

        return $this;
    }

    public function removeCustomer(Customer $customer): static
    {
        if ($this->customers->removeElement($customer)) {
            // set the owning side to null (unless already changed)
            if ($customer->getCountry() === $this) {
                $customer->setCountry(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection<int, EndUser>
     */
    public function getEndUsers(): Collection
    {
        return $this->endUsers;
    }

    public function addEndUser(EndUser $endUser): static
    {
        if (!$this->endUsers->contains($endUser)) {
            $this->endUsers->add($endUser);
            $endUser->setCountry($this);
        }

        return $this;
    }

    public function removeEndUser(EndUser $endUser): static
    {
        if ($this->endUsers->removeElement($endUser)) {
            // set the owning side to null (unless already changed)
            if ($endUser->getCountry() === $this) {
                $endUser->setCountry(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection<int, Location>
     */
    public function getLocations(): Collection
    {
        return $this->locations;
    }

    public function addLocation(Location $location): static
    {
        if (!$this->locations->contains($location)) {
            $this->locations->add($location);
            $location->setCountry($this);
        }

        return $this;
    }

    public function removeLocation(Location $location): static
    {
        if ($this->locations->removeElement($location)) {
            // set the owning side to null (unless already changed)
            if ($location->getCountry() === $this) {
                $location->setCountry(null);
            }
        }

        return $this;
    }

    public function getSapCountryName(): ?string
    {
        return $this->sapCountryName;
    }

    public function setSapCountryName(?string $sapCountryName): static
    {
        $this->sapCountryName = $sapCountryName;

        return $this;
    }

    /**
     * @return Collection<int, GeoArea>
     */
    public function getGeoAreas(): Collection
    {
        return $this->geoAreas;
    }

    public function addGeoArea(GeoArea $geoArea): static
    {
        if (!$this->geoAreas->contains($geoArea)) {
            $this->geoAreas->add($geoArea);
            $geoArea->addCountry($this);
        }

        return $this;
    }

    public function removeGeoArea(GeoArea $geoArea): static
    {
        if ($this->geoAreas->removeElement($geoArea)) {
            $geoArea->removeCountry($this);
        }

        return $this;
    }

    public function getFlagIcon(): ?string
    {
        return $this->flagIcon;
    }

    public function setFlagIcon(?string $flagIcon): static
    {
        $this->flagIcon = $flagIcon;

        return $this;
    }

    public function setTranslatableLocale(string $locale): void
    {
        $this->locale = $locale;
    }

    public function getCapital(): ?string
    {
        return $this->capital;
    }

    public function setCapital(?string $capital): static
    {
        $this->capital = $capital;

        return $this;
    }

    public function getPopulation(): ?int
    {
        return $this->population;
    }

    public function setPopulation(?int $population): static
    {
        $this->population = $population;

        return $this;
    }

    /**
     * @return Collection<int, Currency>
     */
    public function getCurrencies(): Collection
    {
        return $this->currencies;
    }

    public function addCurrency(Currency $currency): static
    {
        if (!$this->currencies->contains($currency)) {
            $this->currencies->add($currency);
            $currency->addCountry($this);
        }

        return $this;
    }

    public function removeCurrency(Currency $currency): static
    {
        if ($this->currencies->removeElement($currency)) {
            $currency->removeCountry($this);
        }

        return $this;
    }
}

CountryTranslation entity code :

<?php

namespace App\Entity\Translation;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Translatable\Entity\MappedSuperclass\AbstractTranslation;
use Gedmo\Translatable\Entity\Repository\TranslationRepository;

#[ORM\Table(name: 'geo_country_translations')]
#[ORM\Index(columns: ['locale', 'object_class', 'field', 'foreign_key'], name: 'geo_country_translation_idx')]
#[ORM\Entity(repositoryClass: TranslationRepository::class)]
class CountryTranslation extends AbstractTranslation
{

}

Full error log :

Doctrine\DBAL\Exception\TableNotFoundException {#8571
  #message: """
    An exception occurred in the driver: SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "abstract_translation_id_seq" does not exist\n
    CONTEXT:  unnamed portal parameter $1 = '...'
    """
  #code: 7
  #file: "P:\DEVZONE\GPS\NcManager\vendor\doctrine\dbal\src\Driver\API\PostgreSQL\ExceptionConverter.php"
  #line: 71
  -previous: Doctrine\DBAL\Driver\PDO\Exception {#8565
    #message: """
      SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "abstract_translation_id_seq" does not exist\n
      CONTEXT:  unnamed portal parameter $1 = '...'
      """
    #code: 7
    #file: "P:\DEVZONE\GPS\NcManager\vendor\doctrine\dbal\src\Driver\PDO\Exception.php"
    #line: 28
    -previous: PDOException {#8562
      #message: """
        SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "abstract_translation_id_seq" does not exist\n
        CONTEXT:  unnamed portal parameter $1 = '...'
        """
      #code: "42P01"
      #file: "P:\DEVZONE\GPS\NcManager\vendor\doctrine\dbal\src\Driver\PDO\Connection.php"
      #line: 103
      +errorInfo: array:3 [
        0 => "42P01"
        1 => 7
        2 => """
          ERROR:  relation "abstract_translation_id_seq" does not exist\n
          CONTEXT:  unnamed portal parameter $1 = '...'
          """
      ]
      trace: {
        P:\DEVZONE\GPS\NcManager\vendor\doctrine\dbal\src\Driver\PDO\Connection.php:103 { …}
        P:\DEVZONE\GPS\NcManager\vendor\doctrine\dbal\src\Driver\Middleware\AbstractConnectionMiddleware.php:62 { …}
        P:\DEVZONE\GPS\NcManager\vendor\doctrine\dbal\src\Driver\Middleware\AbstractConnectionMiddleware.php:62 { …}
        P:\DEVZONE\GPS\NcManager\vendor\doctrine\dbal\src\Connection.php:1249 { …}
        P:\DEVZONE\GPS\NcManager\vendor\doctrine\orm\lib\Doctrine\ORM\Id\IdentityGenerator.php:48 { …}
        P:\DEVZONE\GPS\NcManager\vendor\doctrine\orm\lib\Doctrine\ORM\Persisters\Entity\BasicEntityPersister.php:283 { …}
        P:\DEVZONE\GPS\NcManager\vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php:1179 { …}
        P:\DEVZONE\GPS\NcManager\vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php:443 { …}
        P:\DEVZONE\GPS\NcManager\vendor\doctrine\orm\lib\Doctrine\ORM\EntityManager.php:403 { …}
        P:\DEVZONE\GPS\NcManager\src\Service\Importer\Geo\CountryImporter.php:65 {
          App\Service\Importer\Geo\CountryImporter->completeCountriesLangsAndCurrrencies(bool $update = true): void
          › foreach ($data['translations'] as $langIso2 => $translation) {
          ›     $this->doctrine->getManager()->flush();
          ›     $translatableRepository->translate($country, 'name', $langIso2, $translation);
        }
        P:\DEVZONE\GPS\NcManager\src\Service\Importer\Geo\CountryImporter.php:216 { …}
        P:\DEVZONE\GPS\NcManager\src\Command\FactorySettingsInitializrCommand.php:75 { …}
        P:\DEVZONE\GPS\NcManager\vendor\symfony\console\Command\Command.php:326 { …}
        P:\DEVZONE\GPS\NcManager\vendor\symfony\console\Application.php:1081 { …}
        P:\DEVZONE\GPS\NcManager\vendor\symfony\framework-bundle\Console\Application.php:91 { …}
        P:\DEVZONE\GPS\NcManager\vendor\symfony\console\Application.php:320 { …}
        P:\DEVZONE\GPS\NcManager\vendor\symfony\framework-bundle\Console\Application.php:80 { …}
        P:\DEVZONE\GPS\NcManager\vendor\symfony\console\Application.php:174 { …}
        P:\DEVZONE\GPS\NcManager\vendor\symfony\runtime\Runner\Symfony\ConsoleApplicationRunner.php:54 { …}
        P:\DEVZONE\GPS\NcManager\vendor\autoload_runtime.php:29 { …}
        P:\DEVZONE\GPS\NcManager\bin\console:11 { …}
      }
    }
    -sqlState: "42P01"
    trace: {
      P:\DEVZONE\GPS\NcManager\vendor\doctrine\dbal\src\Driver\PDO\Exception.php:28 { …}
      P:\DEVZONE\GPS\NcManager\vendor\doctrine\dbal\src\Driver\PDO\Connection.php:105 { …}
      P:\DEVZONE\GPS\NcManager\vendor\doctrine\dbal\src\Driver\Middleware\AbstractConnectionMiddleware.php:62 { …}
      P:\DEVZONE\GPS\NcManager\vendor\doctrine\dbal\src\Driver\Middleware\AbstractConnectionMiddleware.php:62 { …}
      P:\DEVZONE\GPS\NcManager\vendor\doctrine\dbal\src\Connection.php:1249 { …}
      P:\DEVZONE\GPS\NcManager\vendor\doctrine\orm\lib\Doctrine\ORM\Id\IdentityGenerator.php:48 { …}
      P:\DEVZONE\GPS\NcManager\vendor\doctrine\orm\lib\Doctrine\ORM\Persisters\Entity\BasicEntityPersister.php:283 { …}
      P:\DEVZONE\GPS\NcManager\vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php:1179 { …}
      P:\DEVZONE\GPS\NcManager\vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php:443 { …}
      P:\DEVZONE\GPS\NcManager\vendor\doctrine\orm\lib\Doctrine\ORM\EntityManager.php:403 { …}
      P:\DEVZONE\GPS\NcManager\src\Service\Importer\Geo\CountryImporter.php:65 {
        App\Service\Importer\Geo\CountryImporter->completeCountriesLangsAndCurrrencies(bool $update = true): void
        › foreach ($data['translations'] as $langIso2 => $translation) {
        ›     $this->doctrine->getManager()->flush();
        ›     $translatableRepository->translate($country, 'name', $langIso2, $translation);
      }
      P:\DEVZONE\GPS\NcManager\src\Service\Importer\Geo\CountryImporter.php:216 { …}
      P:\DEVZONE\GPS\NcManager\src\Command\FactorySettingsInitializrCommand.php:75 { …}
      P:\DEVZONE\GPS\NcManager\vendor\symfony\console\Command\Command.php:326 { …}
      P:\DEVZONE\GPS\NcManager\vendor\symfony\console\Application.php:1081 { …}
      P:\DEVZONE\GPS\NcManager\vendor\symfony\framework-bundle\Console\Application.php:91 { …}
      P:\DEVZONE\GPS\NcManager\vendor\symfony\console\Application.php:320 { …}
      P:\DEVZONE\GPS\NcManager\vendor\symfony\framework-bundle\Console\Application.php:80 { …}
      P:\DEVZONE\GPS\NcManager\vendor\symfony\console\Application.php:174 { …}
      P:\DEVZONE\GPS\NcManager\vendor\symfony\runtime\Runner\Symfony\ConsoleApplicationRunner.php:54 { …}
      P:\DEVZONE\GPS\NcManager\vendor\autoload_runtime.php:29 { …}
      P:\DEVZONE\GPS\NcManager\bin\console:11 { …}
    }
  }
  -query: null
  trace: {
    P:\DEVZONE\GPS\NcManager\vendor\doctrine\dbal\src\Driver\API\PostgreSQL\ExceptionConverter.php:71 { …}
    P:\DEVZONE\GPS\NcManager\vendor\doctrine\dbal\src\Connection.php:1935 { …}
    P:\DEVZONE\GPS\NcManager\vendor\doctrine\dbal\src\Connection.php:1884 { …}
    P:\DEVZONE\GPS\NcManager\vendor\doctrine\dbal\src\Connection.php:1251 { …}
    P:\DEVZONE\GPS\NcManager\vendor\doctrine\orm\lib\Doctrine\ORM\Id\IdentityGenerator.php:48 { …}
    P:\DEVZONE\GPS\NcManager\vendor\doctrine\orm\lib\Doctrine\ORM\Persisters\Entity\BasicEntityPersister.php:283 { …}
    P:\DEVZONE\GPS\NcManager\vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php:1179 { …}
    P:\DEVZONE\GPS\NcManager\vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php:443 { …}
    P:\DEVZONE\GPS\NcManager\vendor\doctrine\orm\lib\Doctrine\ORM\EntityManager.php:403 { …}
    P:\DEVZONE\GPS\NcManager\src\Service\Importer\Geo\CountryImporter.php:65 {
      App\Service\Importer\Geo\CountryImporter->completeCountriesLangsAndCurrrencies(bool $update = true): void
      › foreach ($data['translations'] as $langIso2 => $translation) {
      ›     $this->doctrine->getManager()->flush();
      ›     $translatableRepository->translate($country, 'name', $langIso2, $translation);
    }
    P:\DEVZONE\GPS\NcManager\src\Service\Importer\Geo\CountryImporter.php:216 { …}
    P:\DEVZONE\GPS\NcManager\src\Command\FactorySettingsInitializrCommand.php:75 { …}
    P:\DEVZONE\GPS\NcManager\vendor\symfony\console\Command\Command.php:326 { …}
    P:\DEVZONE\GPS\NcManager\vendor\symfony\console\Application.php:1081 { …}
    P:\DEVZONE\GPS\NcManager\vendor\symfony\framework-bundle\Console\Application.php:91 { …}
    P:\DEVZONE\GPS\NcManager\vendor\symfony\console\Application.php:320 { …}
    P:\DEVZONE\GPS\NcManager\vendor\symfony\framework-bundle\Console\Application.php:80 { …}
    P:\DEVZONE\GPS\NcManager\vendor\symfony\console\Application.php:174 { …}
    P:\DEVZONE\GPS\NcManager\vendor\symfony\runtime\Runner\Symfony\ConsoleApplicationRunner.php:54 { …}
    P:\DEVZONE\GPS\NcManager\vendor\autoload_runtime.php:29 { …}
    P:\DEVZONE\GPS\NcManager\bin\console:11 { …}
  }
}
@phansys
Copy link
Collaborator

phansys commented Aug 22, 2023

Duplicate of #2659.

@VictorKrasnov
Copy link

I've got the same error with Gedmo + Doctrine 2.16-2.17 + Postrges.

An exception occurred in the driver: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "abstract_translation_id_seq" does not exist\n
CONTEXT: unnamed portal parameter $1 = '...'

Are you going to fix it?

@Zhortein
Copy link
Author

With the last releases of doctrin/orm, Gedmo, ... this issue is now solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants