Conditions | 3 |
Paths | 3 |
Total Lines | 26 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | public function save() |
||
23 | { |
||
24 | if ($this->isNew()) { |
||
25 | // insert |
||
26 | $statement = $this->dbObject->prepare(<<<SQL |
||
27 | INSERT INTO userdomain ( |
||
28 | user, domain |
||
29 | ) VALUES ( |
||
30 | :user, :domain |
||
31 | ); |
||
32 | SQL |
||
33 | ); |
||
34 | |||
35 | $statement->bindValue(":user", $this->user); |
||
36 | $statement->bindValue(":domain", $this->domain); |
||
37 | |||
38 | if ($statement->execute()) { |
||
39 | $this->id = (int)$this->dbObject->lastInsertId(); |
||
40 | } |
||
41 | else { |
||
42 | throw new Exception($statement->errorInfo()); |
||
|
|||
43 | } |
||
44 | } |
||
45 | else { |
||
46 | // insert / delete only, no updates please. |
||
47 | throw new Exception('Updating domain membership is not available'); |
||
48 | } |
||
84 | } |