| Conditions | 3 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 58 | public function fetchPerformerIdByName($performerName, $createMissing = false) |
||
| 59 | { |
||
| 60 | $conn = $this->getDbConn(); |
||
| 61 | $sql = 'SELECT id FROM performers p WHERE p.name LIKE :name LIMIT 1'; |
||
| 62 | $performerId = $conn->fetchColumn($sql, ['name' => $performerName]); |
||
| 63 | |||
| 64 | if ($createMissing && !$performerId) { |
||
| 65 | $conn->insert(self::PERFORMERS_TABLE, ['name' => ucwords($performerName)]); |
||
| 66 | //add new performer row |
||
| 67 | $performerId = $conn->lastInsertId(); |
||
| 68 | } |
||
| 69 | |||
| 70 | return $performerId; |
||
| 71 | } |
||
| 72 | } |
||
| 73 |