Details
Description
I'm not very skilled in doctrine yet, but I found something that might be worth reporting.
The code below produces "Class does not exist" error, which is quite misleading and just a side effect of a Notice that shows up in AbstractHydrator.php (lines 190 and 191).
$q = DBConnection::Common()->createQueryBuilder()->select('c')->from('COMPANY', 'c')->getQuery();
$q->setMaxResults(15);
$q->setFirstResult(1);
var_dump($query->getResult());
The query becomes:
SELECT b.* FROM (SELECT a.*, ROWNUM AS doctrine_rownum FROM (SELECT c0_.ID_COMPANY AS ID_COMPANY0, c0_.CONTACT AS CONTACT1, c0_.CONTRACT AS CONTRACT2, c0_.DESCRIPTION AS DESCRIPTION3, c0_.ID_DISPLAY_CASE AS ID_DISPLAY_CASE4, c0_.MAX_OPEN_WIN AS MAX_OPEN_WIN5, c0_.NAME AS NAME6, c0_.REFRESH_TIME AS REFRESH_TIME7, c0_.STATUS AS STATUS8, c0_.TABLESPACE AS TABLESPACE9 FROM COMPANY c0_) a ) b WHERE doctrine_rownum BETWEEN 2 AND 16
The problem occurs when iterating over the list of internal column aliases (ID_COMPANY0,DESCRIPTION3,ID_DISPLAY_CASE4,MAX_OPEN_WIN5,NAME6,REFRESH_TIME7,STATUS8,TABLESPACE9 and
DOCTRINE_ROWNUM). The last one "DOCTRINE_ROWNUM" is missing in both $this->_rsm->metaMappings and $this->_rsm->columnOwnerMap and it's not a matter of case sensitivity, it's missing completely.
Result:
$cache[$key]['dqlAlias'] becomes NULL $rowData[$dqlAlias][$cache[$key]['fieldName']] = $value;
(line 203) creates a new key (named as empty string) in $rowData and things get screwed up since then in further iterations over $rowData array.
Unfortunately I'm not familiar with the internal code of doctrine at all, and it seems too complex for me to be able to provide a fix (except for an ugly hack).
I've attached the Exception trace (might help).
BTW: Doctrine 2 is the cleanest piece of complex code I've ever seen. You guys rock !!!
fixed formating