mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
findAll() don't return all elements #6568
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @secit-pl on GitHub (Nov 12, 2020).
composer.json
While querying for all elements from the database (SQL Server) not all elements are returned.
The problem was noticed when I was using findAll() to get all elements from the database table:
After some debugging I noticed that the problem is not in findAll implementation but in processing the DQL query. See the following example (executed from the Symfony command):
all is ok
Zero matching rows found, so the element with ID 27616 was not returned
One record found - the one missing while using the DQL.
ps. Some time ago I noticed the problem that while using findAll() some elements are missing, and in place of them was returned the previous element (the element which is in previous index in array) but after moving to DQL query the problem disappeared. I thing this might be related to the above problem with missing data.
@Seb33300 commented on GitHub (Nov 13, 2020):
Any cache enabled in your doctrine config?
@secit-pl commented on GitHub (Nov 13, 2020):
Symfony Doctrine configuration:
Entity definition
@Seb33300 commented on GitHub (Nov 13, 2020):
Yes, it looks like you have configured doctrine to use cache.
You should try to clear your cache and test again:
https://symfony.com/doc/current/cache.html#clearing-the-cache
@secit-pl commented on GitHub (Nov 13, 2020):
After each deploy I'm clearing the cache with a following commands:
The output:
@Seb33300 commented on GitHub (Nov 13, 2020):
Something weird may have happened after the deployment.
In my case, every time I am encountering an issue like this one, clearing the doctrine cache solve it.
@beberlei commented on GitHub (Nov 13, 2020):
Why are you using the result cache? Is that needed to scale your project?
@secit-pl commented on GitHub (Nov 13, 2020):
@Seb33300
php bin/console cache:pool:clear cache.global_clearersolves the problem.I don't understand why executing the
was not enough?
@beberlei 1000+ very active users synchronizing application after each action (offline mode support, so the data shot can be very big). Each synchronization is about 40+ serwer requests and makes a lot of db queries. Server is not a high end machine so I need to cache some things to handle requests in reasonable time. Moreover the database is not an ACID compatible (legacy software integration) so I had to make some hacks to handle database inconsistencies.