Skip to content

JSON object not supported, only array #153

@samcat74

Description

@samcat74

MySQL 8.0 + Symfony 7.3 + Doctrine 3.5

My Entity has a $data column like:

#[ORM\Column(type: JsonDocumentType::NAME)]
private object $data;

running a simple query:

$entities = $this->em->getRepository(MyEntity::class)->findAll();

I'm getting this error

Cannot assign array to property App\Entity\MyEntity::$data of type object

if I remove the object :

private object $data;

it works returning an array which breaks my other code, how to make it to work with objects?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions