Result set is empty when using ResultSetMappingBuilder #6815

Open
opened 2026-01-22 15:39:23 +01:00 by admin · 0 comments
Owner

Originally created by @ghost on GitHub (Sep 1, 2021).

The following code

        $rsm = new ResultSetMappingBuilder($this->_em,
            ResultSetMappingBuilder::COLUMN_RENAMING_INCREMENT);
        $rsm->addRootEntityFromClassMetadata('App\Entity\Order', 'o');
        $query = $this->_em->createNativeQuery('CALL usp_order_s_orders()', $rsm);
        $orders = $query->getResult();

returns an empty array even though the result of the SQL query is not empty. If ResultSetMappingBuilder::COLUMN_RENAMING_INCREMENT is removed, then either the entire list is returned, or another error happens, depending on whether or not the Order entity has a one-to-one relation to another table.

Originally created by @ghost on GitHub (Sep 1, 2021). The following code ``` $rsm = new ResultSetMappingBuilder($this->_em, ResultSetMappingBuilder::COLUMN_RENAMING_INCREMENT); $rsm->addRootEntityFromClassMetadata('App\Entity\Order', 'o'); $query = $this->_em->createNativeQuery('CALL usp_order_s_orders()', $rsm); $orders = $query->getResult(); ``` returns an empty array even though the result of the SQL query is not empty. If ResultSetMappingBuilder::COLUMN_RENAMING_INCREMENT is removed, then either the entire list is returned, or another error happens, depending on whether or not the Order entity has a one-to-one relation to another table.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6815