| @@ -14,16 +14,16 @@ | ||
| 14 | 14 | $this->table = 'scenario_process'; |
| 15 | 15 | $this->pkey = 'id'; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - public function getOneByScenarioIdUserId(int $scenarioId, int $userId) | |
| 18 | + public function hasUserProcess(int $scenarioId, int $userId): bool | |
| 19 | 19 | { |
| 20 | - $query = 'SELECT * FROM #__acym_scenario_process WHERE scenario_id = '.$scenarioId.' AND user_id = '.$userId; | |
| 20 | + $process = acym_loadObject('SELECT * FROM #__acym_scenario_process WHERE scenario_id = '.$scenarioId.' AND user_id = '.$userId); | |
| 21 | 21 | |
| 22 | - return acym_loadResult($query); | |
| 22 | + return !empty($process); | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function endProcess(int $scenarioProcessId) | |
| 25 | + public function endProcess(int $scenarioProcessId): void | |
| 26 | 26 | { |
| 27 | 27 | $scenarioProcess = new \stdClass(); |
| 28 | 28 | $scenarioProcess->id = $scenarioProcessId; |
| 29 | 29 | $scenarioProcess->end_at = acym_date('now', 'Y-m-d H:i:s', false); |
| @@ -30,9 +30,9 @@ | ||
| 30 | 30 | |
| 31 | 31 | $this->save($scenarioProcess); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function getNumberOfTriggerByScenarioId(int $scenarioId) | |
| 34 | + public function getNumberOfTriggerByScenarioId(int $scenarioId): int | |
| 35 | 35 | { |
| 36 | 36 | $numberOfTrigger = acym_loadResult('SELECT COUNT(*) FROM #__acym_scenario_process WHERE scenario_id = '.$scenarioId); |
| 37 | 37 | |
| 38 | 38 | if (empty($numberOfTrigger)) { |
| @@ -38,11 +38,10 @@ | ||
| 38 | 38 | if (empty($numberOfTrigger)) { |
| 39 | 39 | return 0; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - return $numberOfTrigger; | |
| 42 | + return (int)$numberOfTrigger; | |
| 43 | 43 | } |
| 44 | - | |
| 45 | 44 | |
| 46 | 45 | public function getMatchingElements(array $settings = []): array |
| 47 | 46 | { |
| 48 | 47 | $results = []; |