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

Delete::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
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