Code Duplication    Length = 30-31 lines in 2 locations

Alpha/Model/ActiveRecordProviderMySQL.php 1 location

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

Alpha/Model/ActiveRecordProviderSQLite.php 1 location

@@ 1504-1534 (lines=31) @@
1501
     *
1502
     * @see Alpha\Model\ActiveRecordProviderInterface::dropTable()
1503
     */
1504
    public function dropTable($tableName = null)
1505
    {
1506
        self::$logger->debug('>>dropTable()');
1507
1508
        if ($tableName == null) {
1509
            $tableName = $this->BO->getTableName();
1510
        }
1511
1512
        // the use of "IF EXISTS" here requires SQLite 3.3.0 or above.
1513
        $sqlQuery = 'DROP TABLE IF EXISTS '.$tableName.';';
1514
1515
        $this->BO->setLastQuery($sqlQuery);
1516
1517
        if (!$result = self::getConnection()->query($sqlQuery)) {
1518
            throw new AlphaException('Failed to drop the table ['.$tableName.'] for the class ['.get_class($this->BO).'], query is ['.$this->BO->getLastQuery().']');
1519
            self::$logger->debug('<<dropTable');
1520
        }
1521
1522
        if ($this->BO->getMaintainHistory()) {
1523
            $sqlQuery = 'DROP TABLE IF EXISTS '.$tableName.'_history;';
1524
1525
            $this->BO->setLastQuery($sqlQuery);
1526
1527
            if (!$result = self::getConnection()->query($sqlQuery)) {
1528
                throw new AlphaException('Failed to drop the table ['.$tableName.'_history] for the class ['.get_class($this->BO).'], query is ['.$this->BO->getLastQuery().']');
1529
                self::$logger->debug('<<dropTable');
1530
            }
1531
        }
1532
1533
        self::$logger->debug('<<dropTable');
1534
    }
1535
1536
    /**
1537
     * (non-PHPdoc).