]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - app/DoctrineMigrations/Version20170719231144.php
Replace raw query with named parameter
[github/wallabag/wallabag.git] / app / DoctrineMigrations / Version20170719231144.php
index 0f5fa75ae527c2708ee2eec30193723ba772e447..265b539a88a50e7199af9defabc0438d693d6ce5 100644 (file)
@@ -27,7 +27,7 @@ class Version20170719231144 extends AbstractMigration implements ContainerAwareI
      */
     public function up(Schema $schema)
     {
-        $this->skipIf($this->connection->getDatabasePlatform()->getName() === 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
+        $this->skipIf('sqlite' === $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
 
         // Find tags which need to be merged
         $dupTags = $this->connection->query('
@@ -42,12 +42,13 @@ class Version20170719231144 extends AbstractMigration implements ContainerAwareI
             $label = $duplicates['LOWER(label)'];
 
             // Retrieve all duplicate tags for a given tag
-            $tags = $this->connection->query('
+            $tags = $this->connection->createQuery('
                 SELECT id
                 FROM   ' . $this->getTable('tag') . "
-                WHERE  LOWER(label) = '" . $label . "'
+                WHERE  LOWER(label) = :label
                 ORDER BY id ASC"
             );
+            $tags->setParameter('label', $label);
             $tags->execute();
 
             $first = true;