| Conditions | 3 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public function storeNewTicket($title, $songId, $userId = null) |
||
| 31 | { |
||
| 32 | $conn = $this->getDbConn(); |
||
| 33 | $max = $conn->fetchAssoc('SELECT max(`offset`) AS o FROM tickets'); |
||
| 34 | |||
| 35 | $maxOffset = $max['o']; |
||
| 36 | $ticket = [ |
||
| 37 | 'title' => $title, |
||
| 38 | 'offset' => $maxOffset + 1, |
||
| 39 | 'songId' => $songId, |
||
| 40 | ]; |
||
| 41 | |||
| 42 | if ($userId) { |
||
| 43 | $ticket['createdBy'] = $userId; |
||
| 44 | } |
||
| 45 | $res = $conn->insert(self::TICKETS_TABLE, $ticket); |
||
| 46 | |||
| 47 | return $res ? $conn->lastInsertId() : false; |
||
|
|
|||
| 48 | } |
||
| 49 | |||
| 73 |