Skip to content

BUG in DoctrineBridge or in DoctrineBundle ? #52614

Closed
@AllanFousse

Description

@AllanFousse

Symfony version(s) affected

6.3

Description

I call the same page twice.
First time no problem, i got this :
[{"id":1,"nom":"a"},{"id":2,"nom":"b"}]

second time I get an error message :
[critical] Uncaught PHP Exception TypeError: "Doctrine\DBAL\Connection::executeQuery(): Argument #1 ($sql) mu
st be of type string, null given, called in /home/allan/PROBLEME/BUG/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Exec/SingleSelectExecutor.php on line
33" at /home/allan/PROBLEME/BUG/vendor/doctrine/dbal/src/Connection.php line 1071

How to reproduce

Create a new 6.3 project with orm

Create this 3 files:

My controller:

class DevController extends AbstractController
{
    #[Route(path: '/')]
    public function dev(ManagerRegistry $managerRegistry): Response
    {
        //$t2 = $managerRegistry->getRepository(Table1::class)->findAll();
        $t2 = $managerRegistry->getRepository(Table1::class)->getAll();
        return new Response(json_encode($t2));
    }
}

My entity class:

#[Entity(repositoryClass: Table1Repository::class)]
#[Table(name: "table1")]
class Table1
{
    #[Id]
    #[Column(name: 'id', type: 'integer')]
    public int $id;

    #[Column(name: 'nom', type: 'string')]
    public string $nom;
}

My Repository file :

class Table1Repository extends EntityRepository
{
    public function getAll(): mixed
    {
        $query = $this->createQueryBuilder('t');
        return $query->getQuery()->getResult();
    }
}

Possible Solution

No idea

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions