I have to create collection for users per each day they register so if I have 5 users and 2 register on 2013-03-02 and 3 have register on 2013-03-03 I will have 2 collections
The user is declare in a YML file with no collection
In the project I do an import via CLI something like this
foreach($arUsers as $key=>$arUser)
{
$collection_name = "day_".$arUser['date'];
$user = new User();
/* Change the collection name to be dynamic */
$OdmMetaData = MeltApplication::getDocumentManager()->getClassMetaData( get_class($user) );
$OdmMetaData->setCollection($collection_name);
$user->setUserId($arUser['user_id']);
$user->setEmail($arUser['email']);
....
$this->getDocumentManager()->persist($user);
$this->getDocumentManager()->flush();
}
Problem is that when I look in the mongoDB I see only one collection with name day_2013-03-03" which is the last date , if I set the MeltApplication::getDocumentManager()->flush(); after the foreach end statement which I should it save all in the first collection 03-02 .
Are there any options to do this , to save them separate?
Thanks