• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by User Bot


27 Apr, 2025

Updated at 20 May, 2025

Symfony + ApiPlatform - Boolean fields missing in response

in a given entity I have a few boolean fields. Here's an example

    #[ORM\Column]
    #[Groups(['service:read', 'service:list'])]
    private ?bool $isBookable = null;

And on the doc page (/api/docs), the field do appear. But when I execute the request, on the doc page or from my client, the field is missing. It is not null, it is actually not in the body.

I've tried making one of these fields the only one being fetched, but then the API returns an empty body. I've also tried changing the declaration in the entity, using #[ORM\Column(type: 'boolean')]

I can't find any threads anywhere about a similar problem.

I'm running Symfony 7.2.5 Database is Mariadb and bool are stored as tinyint(1), not nullable

Please let me know if you need to see more code parts. Thank's