Skip to content

Error with entities with ULID ids after update from 2.7.0 to 2.7.2 #990

@Skorpio84

Description

@Skorpio84

Hi,

I have entities with the following id definitions:

#[ORM\Id]
#[ORM\Column(type: UlidType::NAME, unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.ulid_generator')]
private ?Ulid $id = null;

After the update to 2.7.2, I get the following error while fixtures are created:

An exception occurred while executing a query: SQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for type uuid: "XXX" CONTEXT:  unnamed portal parameter $1 = '...' 

Has it something to do with #980 and how can this be fixed?

Stacktrace:

#0 \vendor\doctrine\dbal\src\Connection.php(1456): Doctrine\DBAL\Driver\API\PostgreSQL\ExceptionConverter->convert(Object(Doctrine\DBAL\Driver\PDO\Exception), Object(Doctrine\DBAL\Query))
#1 \vendor\doctrine\dbal\src\Connection.php(1392): Doctrine\DBAL\Connection->handleDriverException(Object(Doctrine\DBAL\Driver\PDO\Exception), Object(Doctrine\DBAL\Query))
#2 \vendor\doctrine\dbal\src\Connection.php(809): Doctrine\DBAL\Connection->convertExceptionDuringQuery(Object(Doctrine\DBAL\Driver\PDO\Exception), 'SELECT u0_.id A...', Array, Array)
#3 \vendor\doctrine\orm\src\Query\Exec\FinalizedSelectExecutor.php(27): Doctrine\DBAL\Connection->executeQuery('SELECT u0_.id A...', Array, Array, NULL)
#4 \vendor\doctrine\orm\src\Query.php(296): Doctrine\ORM\Query\Exec\FinalizedSelectExecutor->execute(Object(Doctrine\DBAL\Connection), Array, Array)
#5 \vendor\doctrine\orm\src\AbstractQuery.php(935): Doctrine\ORM\Query->_doExecute()
#6 \vendor\doctrine\orm\src\AbstractQuery.php(891): Doctrine\ORM\AbstractQuery->executeIgnoreQueryCache(NULL, 1)
#7 \vendor\doctrine\orm\src\AbstractQuery.php(689): Doctrine\ORM\AbstractQuery->execute(NULL, 1)
#8 \vendor\zenstruck\foundry\src\ORM\AbstractORMPersistenceStrategy.php(127): Doctrine\ORM\AbstractQuery->getResult()
#9 \vendor\zenstruck\foundry\src\Persistence\PersistenceManager.php(436): Zenstruck\Foundry\ORM\AbstractORMPersistenceStrategy->findBy('App\\Entity\\User', Array, NULL, 1, 0)
#10 \vendor\zenstruck\foundry\src\Persistence\RepositoryDecorator.php(139): Zenstruck\Foundry\Persistence\PersistenceManager->findBy('App\\Entity\\User', Array, NULL, 1, 0)
#11 \vendor\zenstruck\foundry\src\Persistence\ProxyRepositoryDecorator.php(106): Zenstruck\Foundry\Persistence\RepositoryDecorator->findBy(Array, NULL, 1, 0)
#12 \vendor\zenstruck\foundry\src\Persistence\RepositoryDecorator.php(202): Zenstruck\Foundry\Persistence\ProxyRepositoryDecorator->findBy(Array, NULL, 1, 0)
#13 \vendor\zenstruck\foundry\src\Persistence\ProxyRepositoryDecorator.php(124): Zenstruck\Foundry\Persistence\RepositoryDecorator->random(Array)
#14 \vendor\zenstruck\foundry\src\Persistence\PersistentObjectFactory.php(171): Zenstruck\Foundry\Persistence\ProxyRepositoryDecorator->random(Array)
#15 \vendor\zenstruck\foundry\src\Persistence\PersistentProxyObjectFactory.php(125): Zenstruck\Foundry\Persistence\PersistentObjectFactory::random(Array)
#16 \src\DataFixtures\UserGroupFixtures.php(37): Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory::random(Array)
#17 \vendor\doctrine\data-fixtures\src\Executor\AbstractExecutor.php(86): App\DataFixtures\UserGroupFixtures->load(Object(ContainerPsEdPB8\EntityManagerGhost07d86ea))
#18 \vendor\doctrine\data-fixtures\src\Executor\ORMExecutor.php(26): Doctrine\Common\DataFixtures\Executor\AbstractExecutor->load(Object(ContainerPsEdPB8\EntityManagerGhost07d86ea), Object(App\DataFixtures\UserGroupFixtures))
#19 \vendor\doctrine\orm\src\EntityManager.php(187): Doctrine\Common\DataFixtures\Executor\ORMExecutor::Doctrine\Common\DataFixtures\Executor\{closure}(Object(ContainerPsEdPB8\EntityManagerGhost07d86ea))
#20 \vendor\doctrine\data-fixtures\src\Executor\ORMExecutor.php(20): Doctrine\ORM\EntityManager->wrapInTransaction(Object(Closure))
#21 \vendor\doctrine\doctrine-fixtures-bundle\src\Command\LoadDataFixturesDoctrineCommand.php(140): Doctrine\Common\DataFixtures\Executor\ORMExecutor->execute(Array, false)
#22 \vendor\symfony\console\Command\Command.php(318): Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 \vendor\symfony\console\Application.php(1110): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 \vendor\symfony\framework-bundle\Console\Application.php(123): Symfony\Component\Console\Application->doRunCommand(Object(Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 \vendor\symfony\console\Application.php(359): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand(Object(Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 \vendor\symfony\framework-bundle\Console\Application.php(77): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 \vendor\symfony\console\Application.php(194): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 \vendor\symfony\runtime\Runner\Symfony\ConsoleApplicationRunner.php(49): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 \vendor\autoload_runtime.php(29): Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run()
#30 \bin\console(15): require_once('D:\\workspaces\\V...')
#31 {main}

Line 37 in UserGroupFixtures contains:

UserFactory::random(['company' => $company])

$company has also an Ulid as ID

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions