Open popovserhii opened 8 years ago
Please explain
Hello, @safrazik When I use simple request for get data from server I get the error "Not all identifier properties can be found in the ResultSetMapping" screen I was wrong in first comment, this happen after upgrade Doctrine 2.1 -> 2.2.
This is example of full stack error:
Not all identifier properties can be found in the ResultSetMapping
File: /home/www/example.com/web/lib/Doctrine/ORM/Tools/Pagination/CountOutputWalker.php
String: 107
#0 /home/www/example.com/web/lib/Doctrine/ORM/Query/Exec/SingleSelectExecutor.php(38): Doctrine\ORM\Tools\Pagination\CountOutputWalker->walkSelectStatement(Object(Doctrine\ORM\Query\AST\SelectStatement))
#1 /home/www/example.com/web/lib/Doctrine/ORM/Query/SqlWalker.php(192): Doctrine\ORM\Query\Exec\SingleSelectExecutor->__construct(Object(Doctrine\ORM\Query\AST\SelectStatement), Object(Doctrine\ORM\Tools\Pagination\CountOutputWalker))
#2 /home/www/example.com/web/lib/Doctrine/ORM/Query/Parser.php(325): Doctrine\ORM\Query\SqlWalker->getExecutor(Object(Doctrine\ORM\Query\AST\SelectStatement))
#3 /home/www/example.com/web/lib/Doctrine/ORM/Query.php(211): Doctrine\ORM\Query\Parser->parse()
#4 /home/www/example.com/web/lib/Doctrine/ORM/Query.php(241): Doctrine\ORM\Query->_parse()
#5 /home/www/example.com/web/lib/Doctrine/ORM/AbstractQuery.php(647): Doctrine\ORM\Query->_doExecute()
#6 /home/www/example.com/web/lib/Doctrine/ORM/AbstractQuery.php(496): Doctrine\ORM\AbstractQuery->execute(Array, 3)
#7 /home/www/example.com/web/lib/Doctrine/ORM/Tools/Pagination/Paginator.php(148): Doctrine\ORM\AbstractQuery->getScalarResult()
#8 [internal function]: Doctrine\ORM\Tools\Pagination\Paginator->count()
Didn't you see the error on Doctrine version 2.5? What version are you using now? By the way, at least Doctrine 2.4 is recommended for all the functionalities of the library to work
I check composer installed package outputs
...
doctrine/annotations v1.2.7 Docblock Annotation...
doctrine/cache v1.6.0 Caching library off...
doctrine/collections v1.3.0 Collections Abstrac...
doctrine/common v2.5.3 Common Library for ...
doctrine/dbal v2.5.4 Database Abstractio...
doctrine/doctrine-module 0.8.0 Zend Framework 2 Mo...
doctrine/doctrine-orm-module 0.9.2 Zend Framework 2 Mo...
doctrine/inflector v1.1.0 Common String Manip...
doctrine/instantiator 1.0.5 A small, lightweigh...
doctrine/lexer v1.0.1 Base library for a ...
doctrine/migrations 1.4.1 Database Schema mig...
doctrine/orm v2.5.4 Object-Relational-M...
...
As I can see Doctrine version is 2.5.
In general after googling I found that this error appears after upgrade Doctrine 2.1 -> 2.2.
Hello, @safrazik Please, tell me is it possible to accept my PR or your library will be support only Doctrine <=2.4?
Thank you for response.
This library supports doctrine >=2.4 already. I remember I've faced this error with doctrine. I guess it occurrs when trying to use $select/$count or $expand complex query. I'm afraid your code may cause side effects on existing code. You mentioned "simple request for get data from" can you please post here the query you made? (The query URL parameters or JavaScript code). Thanks. I am reviewing your fix
Request is very simple, doctrine model doesn't have any association
GET: http://localhost/breeze/Servers?$top=100&$select=id%2Cname&$inlinecount=allpages
I am trying to reproduce your error. I will notify you when I'm done
Better workaround for this issue can be as the following:
$paginator = new Paginator($query, $fetchJoinCollection);
if ($fetchCount) {
if(isset($params->select)){
// workaround for issue #25 Error when using both $inlinecount & $select : Not all identifier properties can be found in the ResultSetMapping: id
$paginator->setUseOutputWalkers(false);
}
$inlineCount = count($paginator);
}
Error "Not all identifier properties can be found in the ResultSetMapping" has been fixed in Doctrine 2.5