Closed tacman closed 8 months ago
To reproduce:
symfony new api-bug --webapp && cd api-bug
composer config extra.symfony.allow-contrib true
echo "DATABASE_URL=sqlite:///%kernel.project_dir%/var/data.db" > .env.local
composer require api
echo "title,string,80,yes," | sed "s/,/\n/g" | bin/console -a make:entity Book
bin/console doctrine:schema:update --force --complete
symfony server:start -d
symfony open:local --path=/api
Now add a Book via post
curl -X 'POST' \
'https://127.0.0.1:8000/api/books' \
-H 'accept: application/ld+json' \
-H 'Content-Type: application/ld+json' \
-d '{
"title": "Symfony Fast Track"
}'
{
"@id": "/api/errors/500",
"@type": "hydra:Error",
"title": "An error occurred",
"detail": "Attempted to load class \"ClassUtils\" from namespace \"Doctrine\\Common\\Util\".\nDid you forget a \"use\" statement for another namespace?",
"status": 500,
"type": "/errors/500",
"trace": [
{
"file": "/home/tac/g/trash/api-bug/vendor/symfony/ux-turbo/src/Doctrine/BroadcastListener.php",
"line": 73,
"function": "storeEntitiesToPublish",
"class": "Symfony\\UX\\Turbo\\Doctrine\\BroadcastListener",
"type": "->"
},
{
"file": "/home/tac/g/trash/api-bug/vendor/symfony/doctrine-bridge/ContainerAwareEventManager.php",
"line": 63,
"function": "onFlush",
"class": "Symfony\\UX\\Turbo\\Doctrine\\BroadcastListener",
"type": "->"
},
{
"file": "/home/tac/g/trash/api-bug/vendor/doctrine/orm/src/UnitOfWork.php",
"line": 3117,
"function": "dispatchEvent",
"class": "Symfony\\Bridge\\Doctrine\\ContainerAwareEventManager",
"type": "->"
},
{
"file": "/home/tac/g/trash/api-bug/vendor/doctrine/orm/src/UnitOfWork.php",
"line": 377,
"function": "dispatchOnFlushEvent",
"class": "Doctrine\\ORM\\UnitOfWork",
"type": "->"
},
{
"file": "/home/tac/g/trash/api-bug/vendor/doctrine/orm/src/EntityManager.php",
will release today
API Platform version(s) affected: 3.2
Description
SearchFilter.php tries to match against Types::ARRAY, which no longer exists.
https://github.com/api-platform/core/blob/main/src/Doctrine/Orm/Filter/SearchFilter.php#L370-L379
Upgrade a Symfony project to use doctrine/orm 3. Api calls then fail.