I want to refac a native SQL query with the doctrine querybuilder.
In this case I get the following error:
The query executes and returns a result (with and without joins).
But when I add a simple WHERE the basic entity values are NULL.
Tested
- QueryBuilder (complex: as default I need six joins)
- QueryBuilder (simple: no join)
- HQL
- different getResult() and execute() calls
Versions:
PHP 7.0 (no updates possible ...)
./composer.phar info | grep doctrine
doctrine/annotations v1.4.0 Docblock Annotations Parser
doctrine/cache v1.6.2 Caching library offering an object-oriented API for many cache backends
doctrine/collections v1.4.0 Collections Abstraction library
doctrine/common v2.7.3 Common Library for Doctrine projects
doctrine/dbal v2.5.13 Database Abstraction Layer
doctrine/doctrine-bundle 1.10.3 Symfony DoctrineBundle
doctrine/doctrine-cache-bundle 1.3.5 Symfony Bundle for Doctrine Cache
doctrine/inflector v1.2.0 Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator 1.0.5 A small, lightweight utility to instantiate objects in PHP without invoking their cons...
doctrine/lexer 1.0.2 PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Pars...
doctrine/orm v2.5.14 Object-Relational-Mapper for PHP
Some code
The basic values are filled (like id and title).
$qb = $this->createQueryBuilder('artikel')
;
return $qb->getQuery()->execute();
The basic values are null except the id.
$qb = $this->createQueryBuilder('artikel')
->andWhere('artikel.id = :ids')
->setParameter('ids', '1010729320')
;
return $qb->getQuery()->execute();
Why are the basic value null when I use the WHERE clause?