mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
Multiple ORMs for all database
This commit is contained in:
@@ -58,21 +58,21 @@ class patch_320alpha2a extends patchAbstract
|
||||
public function apply(base $appbox, Application $app)
|
||||
{
|
||||
$dql = 'SELECT u FROM Phraseanet:User u WHERE u.nonce IS NULL';
|
||||
$q = $app['EM']->createQuery($dql);
|
||||
$q = $app['orm.em']->createQuery($dql);
|
||||
$q->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true);
|
||||
$users = $q->getResult();
|
||||
|
||||
$n = 0;
|
||||
foreach ($users as $user) {
|
||||
$user->setNonce($app['random.medium']->generateString(64));
|
||||
$app['EM']->persist($user);
|
||||
$app['orm.em']->persist($user);
|
||||
$n++;
|
||||
if ($n %100 === 0) {
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
}
|
||||
}
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$sql = 'SELECT task_id, `class` FROM task2';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
|
Reference in New Issue
Block a user