Code Duplication    Length = 30-31 lines in 2 locations

Alpha/Model/ActiveRecordProviderMySQL.php 1 location

@@ 1450-1479 (lines=30) @@
1447
     *
1448
     * @see Alpha\Model\ActiveRecordProviderInterface::dropTable()
1449
     */
1450
    public function dropTable($tableName = null)
1451
    {
1452
        self::$logger->debug('>>dropTable()');
1453
1454
        if ($tableName == null) {
1455
            $tableName = $this->BO->getTableName();
1456
        }
1457
1458
        $sqlQuery = 'DROP TABLE IF EXISTS '.$tableName.';';
1459
1460
        $this->BO->setLastQuery($sqlQuery);
1461
1462
        if (!$result = self::getConnection()->query($sqlQuery)) {
1463
            throw new AlphaException('Failed to drop the table ['.$tableName.'] for the class ['.get_class($this->BO).'], query is ['.$this->BO->getLastQuery().']');
1464
            self::$logger->debug('<<dropTable');
1465
        }
1466
1467
        if ($this->BO->getMaintainHistory()) {
1468
            $sqlQuery = 'DROP TABLE IF EXISTS '.$tableName.'_history;';
1469
1470
            $this->BO->setLastQuery($sqlQuery);
1471
1472
            if (!$result = self::getConnection()->query($sqlQuery)) {
1473
                throw new AlphaException('Failed to drop the table ['.$tableName.'_history] for the class ['.get_class($this->BO).'], query is ['.$this->BO->getLastQuery().']');
1474
                self::$logger->debug('<<dropTable');
1475
            }
1476
        }
1477
1478
        self::$logger->debug('<<dropTable');
1479
    }
1480
1481
    /**
1482
     * (non-PHPdoc).

Alpha/Model/ActiveRecordProviderSQLite.php 1 location

@@ 1472-1502 (lines=31) @@
1469
     *
1470
     * @see Alpha\Model\ActiveRecordProviderInterface::dropTable()
1471
     */
1472
    public function dropTable($tableName = null)
1473
    {
1474
        self::$logger->debug('>>dropTable()');
1475
1476
        if ($tableName == null) {
1477
            $tableName = $this->BO->getTableName();
1478
        }
1479
1480
        // the use of "IF EXISTS" here requires SQLite 3.3.0 or above.
1481
        $sqlQuery = 'DROP TABLE IF EXISTS '.$tableName.';';
1482
1483
        $this->BO->setLastQuery($sqlQuery);
1484
1485
        if (!$result = self::getConnection()->query($sqlQuery)) {
1486
            self::$logger->debug('<<dropTable');
1487
            throw new AlphaException('Failed to drop the table ['.$tableName.'] for the class ['.get_class($this->BO).'], query is ['.$this->BO->getLastQuery().']');
1488
        }
1489
1490
        if ($this->BO->getMaintainHistory()) {
1491
            $sqlQuery = 'DROP TABLE IF EXISTS '.$tableName.'_history;';
1492
1493
            $this->BO->setLastQuery($sqlQuery);
1494
1495
            if (!$result = self::getConnection()->query($sqlQuery)) {
1496
                self::$logger->debug('<<dropTable');
1497
                throw new AlphaException('Failed to drop the table ['.$tableName.'_history] for the class ['.get_class($this->BO).'], query is ['.$this->BO->getLastQuery().']');
1498
            }
1499
        }
1500
1501
        self::$logger->debug('<<dropTable');
1502
    }
1503
1504
    /**
1505
     * (non-PHPdoc).