Code Duplication    Length = 13-13 lines in 3 locations

eZ/Publish/Core/Persistence/Doctrine/ConnectionHandler/SqliteConnectionHandler.php 3 locations

@@ 48-60 (lines=13) @@
45
     */
46
    public function getAutoIncrementValue($table, $column)
47
    {
48
        if (($table === 'ezcontentobject_attribute') && ($column === 'id')) {
49
            // This is a @HACK -- since this table has a multi-column key with
50
            // auto-increment, which is not easy to simulate in SQLite. This
51
            // solves it for now.
52
            $q = $this->createSelectQuery();
53
            $q->select($q->expr->max('id'))->from('ezcontentobject_attribute');
54
            $statement = $q->prepare();
55
            $statement->execute();
56
57
            $this->lastInsertedIds['ezcontentobject_attribute.id'] = (int)$statement->fetchColumn() + 1;
58
59
            return $this->lastInsertedIds['ezcontentobject_attribute.id'];
60
        }
61
62
        if (($table === 'ezcontentclass') && ($column === 'id')) {
63
            // This is a @HACK -- since this table has a multi-column key with
@@ 62-74 (lines=13) @@
59
            return $this->lastInsertedIds['ezcontentobject_attribute.id'];
60
        }
61
62
        if (($table === 'ezcontentclass') && ($column === 'id')) {
63
            // This is a @HACK -- since this table has a multi-column key with
64
            // auto-increment, which is not easy to simulate in SQLite. This
65
            // solves it for now.
66
            $q = $this->createSelectQuery();
67
            $q->select($q->expr->max('id'))->from('ezcontentclass');
68
            $statement = $q->prepare();
69
            $statement->execute();
70
71
            $this->lastInsertedIds['ezcontentclass.id'] = (int)$statement->fetchColumn() + 1;
72
73
            return $this->lastInsertedIds['ezcontentclass.id'];
74
        }
75
76
        if (($table === 'ezcontentclass_attribute') && ($column === 'id')) {
77
            // This is a @HACK -- since this table has a multi-column key with
@@ 76-88 (lines=13) @@
73
            return $this->lastInsertedIds['ezcontentclass.id'];
74
        }
75
76
        if (($table === 'ezcontentclass_attribute') && ($column === 'id')) {
77
            // This is a @HACK -- since this table has a multi-column key with
78
            // auto-increment, which is not easy to simulate in SQLite. This
79
            // solves it for now.
80
            $q = $this->createSelectQuery();
81
            $q->select($q->expr->max('id'))->from('ezcontentclass_attribute');
82
            $statement = $q->prepare();
83
            $statement->execute();
84
85
            $this->lastInsertedIds['ezcontentclass_attribute.id'] = (int)$statement->fetchColumn() + 1;
86
87
            return $this->lastInsertedIds['ezcontentclass_attribute.id'];
88
        }
89
90
        return 'NULL';
91
    }