When I try to get data from multiple collections code it is giving me data only from the first collection i.e collections are project_0, project_1, project_2, project_3
for($i = 0; $i <= 3; $i++){
$dm->getClassMetadata('\Application\Document\Product')->setCollection('product_'. $i);
$record = $dm->getRepository('\Application\Document\Product')->findOneBy($condition);
print_r($record);
}
I tried to clear flush but noting is working. Please let me know the right way to do it?