Merge pull request #968 from romainneutron/doctrine-connection

[3.9] Use Doctrine DBAL as connection
This commit is contained in:
Nicolas Le Goff
2014-02-24 12:15:03 +01:00
62 changed files with 438 additions and 620 deletions

View File

@@ -116,7 +116,7 @@ class patch_320alpha4a implements patchInterface
$databox->delete_data_from_cache(databox::CACHE_STRUCTURE);
$databox->delete_data_from_cache(databox::CACHE_META_STRUCT);
$conn = connection::getPDOConnection($app);
$conn = $app['phraseanet.appbox']->get_connection();
$sql = 'DELETE FROM `task2` WHERE class="readmeta"';
$stmt = $conn->prepare($sql);

View File

@@ -10,6 +10,7 @@
*/
use Alchemy\Phrasea\Application;
use Doctrine\DBAL\DBALException;
class patch_360alpha1b implements patchInterface
{
@@ -62,7 +63,7 @@ class patch_360alpha1b implements patchInterface
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
} catch (\PDOException $e) {
} catch (DBALException $e) {
}

View File

@@ -10,6 +10,7 @@
*/
use Alchemy\Phrasea\Application;
use Doctrine\DBAL\DBALException;
class patch_360alpha2b implements patchInterface
{
@@ -78,7 +79,7 @@ class patch_360alpha2b implements patchInterface
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
} catch (\Exception $e) {
} catch (DBALException $e) {
}
@@ -88,7 +89,7 @@ class patch_360alpha2b implements patchInterface
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
} catch (\PDOException $e) {
} catch (DBALException $e) {
}

View File

@@ -69,7 +69,7 @@ class patch_361alpha1a implements patchInterface
$sbas_id = (int) $row['sbas_id'];
try {
$connbas = connection::getPDOConnection($app, $sbas_id);
$connbas = $app['phraseanet.appbox']->get_databox($sbas_id)->get_connection()->connect();
} catch (\Exception $e) {
$conn->exec('DELETE FROM ValidationDatas WHERE basket_element_id = ' . $row['id']);
$conn->exec('DELETE FROM BasketElements WHERE id = ' . $row['id']);

View File

@@ -12,6 +12,7 @@
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Model\Entities\LazaretFile;
use Alchemy\Phrasea\Model\Entities\LazaretSession;
use Doctrine\DBAL\DBALException;
use MediaAlchemyst\Exception\ExceptionInterface as MediaAlchemystException;
use MediaAlchemyst\Specification\Image as ImageSpec;
@@ -68,7 +69,7 @@ class patch_370alpha7a extends patchAbstract
$stmt = $conn->prepare($sql);
$stmt->execute();
$rs = $stmt->fetchAll();
} catch (\PDOException $e) {
} catch (DBALException $e) {
// table not found
if ($e->getCode() == '42S02') {

View File

@@ -12,6 +12,7 @@
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Model\Entities\Session;
use Alchemy\Phrasea\Model\Entities\SessionModule;
use Doctrine\DBAL\DBALException;
class patch_380alpha11a extends patchAbstract
{
@@ -66,7 +67,7 @@ class patch_380alpha11a extends patchAbstract
$stmt->execute();
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
} catch (\PDOException $e) {
} catch (DBALException $e) {
// this may fail on oldest versions
return false;
}