Completed
Push — 2.0 ( ada449...a2425b )
by Vermeulen
01:55
created

Delete   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A assembleRequest() 0 6 1
1
<?php
2
3
namespace BfwSql\Actions;
4
5
/**
6
 * Class to write DELETE queries
7
 * 
8
 * @package bfw-sql
9
 * @author Vermeulen Maxime <[email protected]>
10
 * @version 2.0
11
 */
12
class Delete extends AbstractActions
13
{
14
    /**
15
     * Constructor
16
     * 
17
     * @param \BfwSql\SqlConnect $sqlConnect Instance of SGBD connexion
18
     * @param string             $tableName  The table name used for query
19
     */
20
    public function __construct(\BfwSql\SqlConnect $sqlConnect, $tableName)
21
    {
22
        parent::__construct($sqlConnect);
23
        
24
        $prefix          = $sqlConnect->getConnectionInfos()->tablePrefix;
25
        $this->tableName = $prefix.$tableName;
26
    }
27
    
28
    /**
29
     * {@inheritdoc}
30
     */
31
    protected function assembleRequest()
32
    {
33
        $where = $this->generateWhere();
34
        
35
        $this->assembledRequest = 'DELETE FROM '.$this->tableName.$where;
36
    }
37
}
38