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