| @@ 95-113 (lines=19) @@ | ||
| 92 | * |
|
| 93 | * @return \Doctrine\DBAL\Driver\Statement|mixed |
|
| 94 | */ |
|
| 95 | public function findToken($repoHook, $branchHook) |
|
| 96 | { |
|
| 97 | if ($branchHook == null) { |
|
| 98 | $sql = "SELECT token FROM credential AS c JOIN project AS P ON c.idcred = p.credential WHERE p.name = :name AND p.branch = 'all';"; |
|
| 99 | $result = $this->db->prepare($sql); |
|
| 100 | $result->bindValue(':name', $repoHook); |
|
| 101 | } else { |
|
| 102 | $sql = "SELECT token FROM credential AS c JOIN project AS P ON c.idcred = p.credential WHERE p.name = :name AND p.branch = :branch;"; |
|
| 103 | $result = $this->db->prepare($sql); |
|
| 104 | $result->bindValue(':name', $repoHook); |
|
| 105 | $result->bindValue(':branch', $branchHook); |
|
| 106 | } |
|
| 107 | ||
| 108 | $result->execute(); |
|
| 109 | $result = $result->fetch(); |
|
| 110 | $result = $result['token']; |
|
| 111 | ||
| 112 | return $result; |
|
| 113 | } |
|
| 114 | ||
| 115 | /** |
|
| 116 | * @param $repoHook |
|
| @@ 101-119 (lines=19) @@ | ||
| 98 | * |
|
| 99 | * @return \Doctrine\DBAL\Driver\Statement|mixed |
|
| 100 | */ |
|
| 101 | public function findComment($repoHook, $branchHook) |
|
| 102 | { |
|
| 103 | if ($branchHook == null) { |
|
| 104 | $sql = 'SELECT comment FROM project WHERE name = :name AND alive = 1;'; |
|
| 105 | $result = $this->db->prepare($sql); |
|
| 106 | $result->bindValue(':name', $repoHook); |
|
| 107 | } else { |
|
| 108 | $sql = 'SELECT comment FROM project WHERE name = :name AND branch = :branch AND alive = 1'; |
|
| 109 | $result = $this->db->prepare($sql); |
|
| 110 | $result->bindValue(':name', $repoHook); |
|
| 111 | $result->bindValue(':branch', $branchHook); |
|
| 112 | } |
|
| 113 | ||
| 114 | $result->execute(); |
|
| 115 | $result = $result->fetch(); |
|
| 116 | $result = $result['comment']; |
|
| 117 | ||
| 118 | return $result; |
|
| 119 | } |
|
| 120 | ||
| 121 | /** |
|
| 122 | * @param $repoHook |
|
| @@ 127-145 (lines=19) @@ | ||
| 124 | * |
|
| 125 | * @return \Doctrine\DBAL\Driver\Statement|mixed |
|
| 126 | */ |
|
| 127 | public function findId($repoHook, $branchHook) |
|
| 128 | { |
|
| 129 | if ($branchHook == null) { |
|
| 130 | $sql = "SELECT id FROM project AS p , credential AS c WHERE name = :name AND branch = 'all';"; |
|
| 131 | $result = $this->db->prepare($sql); |
|
| 132 | $result->bindValue(':name', $repoHook); |
|
| 133 | } else { |
|
| 134 | $sql = "SELECT id FROM project AS p , credential AS c WHERE name = :name AND branch = :branch;"; |
|
| 135 | $result = $this->db->prepare($sql); |
|
| 136 | $result->bindValue(':name', $repoHook); |
|
| 137 | $result->bindValue(':branch', $branchHook); |
|
| 138 | } |
|
| 139 | ||
| 140 | $result->execute(); |
|
| 141 | $result = $result->fetch(); |
|
| 142 | $result = $result['id']; |
|
| 143 | ||
| 144 | return $result; |
|
| 145 | } |
|
| 146 | ||
| 147 | /** |
|
| 148 | * @param $id |
|