Completed
Push — master ( d015d4...c50906 )
by Mikołaj
02:42
created

AddModel   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A add() 0 17 1
1
<?php
2
3
namespace Rudolf\Modules\Appearance\Menu;
4
5
use Rudolf\Framework\Model\AdminModel;
6
7
class AddModel extends AdminModel
8
{
9
    public function add($p)
10
    {
11
        $stmt = $this->pdo->prepare("INSERT INTO {$this->prefix}menu SET module_name = '',
12
          parent_id = :parent_id, title = :title, slug = :slug, caption = :caption,
13
          menu_type = :menu_type, item_type = :item_type, position = :position");
14
        $stmt->bindValue(':parent_id', $p['parent_id'], \PDO::PARAM_INT);
15
        $stmt->bindValue(':title', $p['title']);
16
        $stmt->bindValue(':slug', $p['slug']);
17
        $stmt->bindValue(':caption', $p['caption']);
18
        $stmt->bindValue(':menu_type', $p['menu_type']);
19
        $stmt->bindValue(':item_type', $p['item_type']);
20
        $stmt->bindValue(':position', (int) $p['position'], \PDO::PARAM_INT);
21
22
        $stmt->execute();
23
24
        return $this->pdo->lastInsertId();
25
    }
26
}
27