| @@ 91-103 (lines=13) @@ | ||
| 88 | * |
|
| 89 | * @return bool |
|
| 90 | */ |
|
| 91 | public function save($dbConnection = NULL) |
|
| 92 | { |
|
| 93 | $connection = DatabaseQuery::checkConnection($dbConnection); |
|
| 94 | ||
| 95 | $query = $this->insertQuery(self::getTableName($connection)); |
|
| 96 | $statement = $connection->prepare($query); |
|
| 97 | if($statement->execute()) { |
|
| 98 | return true; |
|
| 99 | } |
|
| 100 | throw new DataAlreadyExistException(); |
|
| 101 | ||
| 102 | } |
|
| 103 | ||
| 104 | /** |
|
| 105 | * update() |
|
| 106 | * Update details in database after ::find(2) |
|
| @@ 110-121 (lines=12) @@ | ||
| 107 | * |
|
| 108 | * @return bool |
|
| 109 | */ |
|
| 110 | public function update($dbConnection = NULL) |
|
| 111 | { |
|
| 112 | $connection = DatabaseQuery::checkConnection($dbConnection); |
|
| 113 | ||
| 114 | $updateQuery = $this->updateQuery(self::getTableName($connection)); |
|
| 115 | $statement = $connection->prepare($updateQuery); |
|
| 116 | if ($statement->execute()) { |
|
| 117 | return true; |
|
| 118 | } |
|
| 119 | throw new DataAlreadyExistException(); |
|
| 120 | } |
|
| 121 | ||
| 122 | /** |
|
| 123 | * destroy($value) |
|
| 124 | * Delete data from database |
|