Skip to content

Commit 8e178a0

Browse files
committed
Fix model constant issue
1 parent ab474c1 commit 8e178a0

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

src/Core/Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private static function log($level, $message, array $context = [])
139139
}
140140

141141
try {
142-
$error = new ModelObject('KyteError');
142+
$error = new ModelObject(KyteError);
143143

144144
// Get caller information for file/line
145145
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3);

src/Mvc/Controller/CronJobController.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ private function getNextRunTime(int $jobId): ?int
451451
*/
452452
private function handleTrigger(int $jobId): void
453453
{
454-
$job = new ModelObject('CronJob');
454+
$job = new ModelObject(CronJob);
455455
$job->retrieve('id', $jobId);
456456

457457
if (!$job->id) {
@@ -505,7 +505,7 @@ private function handleTrigger(int $jobId): void
505505
*/
506506
private function handleRecover(int $jobId): void
507507
{
508-
$job = new ModelObject('CronJob');
508+
$job = new ModelObject(CronJob);
509509
$job->retrieve('id', $jobId);
510510

511511
if (!$job->id) {
@@ -542,7 +542,7 @@ private function handleRecover(int $jobId): void
542542
*/
543543
private function handleRollback(int $jobId, array $data): void
544544
{
545-
$job = new ModelObject('CronJob');
545+
$job = new ModelObject(CronJob);
546546
$job->retrieve('id', $jobId);
547547

548548
if (!$job->id) {
@@ -571,7 +571,7 @@ private function handleRollback(int $jobId, array $data): void
571571
*/
572572
private function handleStats(int $jobId): void
573573
{
574-
$job = new ModelObject('CronJob');
574+
$job = new ModelObject(CronJob);
575575
$job->retrieve('id', $jobId);
576576

577577
if (!$job->id) {
@@ -616,7 +616,7 @@ private function handleStats(int $jobId): void
616616
*/
617617
private function createDefaultFunctions(int $jobId, ?int $userId): void
618618
{
619-
$job = new ModelObject('CronJob');
619+
$job = new ModelObject(CronJob);
620620
$job->retrieve('id', $jobId);
621621
if (!$job->id) {
622622
return;
@@ -645,7 +645,7 @@ private function createDefaultFunctions(int $jobId, ?int $userId): void
645645
$contentHash = hash('sha256', $functionBody);
646646

647647
// Check if content exists (unlikely for defaults, but check anyway)
648-
$existingContent = new ModelObject('CronJobFunctionContent');
648+
$existingContent = new ModelObject(CronJobFunctionContent);
649649
$existingContent->retrieve('content_hash', $contentHash);
650650

651651
if (!$existingContent->id) {
@@ -660,7 +660,7 @@ private function createDefaultFunctions(int $jobId, ?int $userId): void
660660
'date_created' => time()
661661
];
662662

663-
$contentObj = new ModelObject('CronJobFunctionContent');
663+
$contentObj = new ModelObject(CronJobFunctionContent);
664664
$contentObj->create($contentData, $userId);
665665
} else {
666666
// Increment reference count
@@ -679,7 +679,7 @@ private function createDefaultFunctions(int $jobId, ?int $userId): void
679679
'date_created' => time()
680680
];
681681

682-
$functionObj = new ModelObject('CronJobFunction');
682+
$functionObj = new ModelObject(CronJobFunction);
683683
$functionObj->create($functionData, $userId);
684684

685685
// Create initial version (version 1)

src/Mvc/Controller/CronJobFunctionController.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function new($data)
4141
return;
4242
}
4343

44-
$cronJob = new ModelObject('CronJob');
44+
$cronJob = new ModelObject(CronJob);
4545
$cronJob->retrieve('id', $data['cron_job']);
4646
if (!$cronJob->id) {
4747
$this->respondError('Cron job not found', 404);
@@ -63,7 +63,7 @@ public function new($data)
6363
$contentHash = hash('sha256', $functionBody);
6464

6565
// Check if content already exists
66-
$existingContent = new ModelObject('CronJobFunctionContent');
66+
$existingContent = new ModelObject(CronJobFunctionContent);
6767
$existingContent->retrieve('content_hash', $contentHash);
6868

6969
if ($existingContent->id) {
@@ -82,7 +82,7 @@ public function new($data)
8282
'date_created' => time()
8383
];
8484

85-
$contentObj = new ModelObject('CronJobFunctionContent');
85+
$contentObj = new ModelObject(CronJobFunctionContent);
8686
$contentObj->create($contentData, $this->api->user ? $this->api->user->id : null);
8787
}
8888

@@ -116,7 +116,7 @@ public function update($field, $value, $data)
116116
{
117117
$functionId = $value;
118118

119-
$function = new ModelObject('CronJobFunction');
119+
$function = new ModelObject(CronJobFunction);
120120
$function->retrieve('id', $functionId);
121121
if (!$function->id) {
122122
$this->respondError('Function not found', 404);
@@ -150,7 +150,7 @@ public function update($field, $value, $data)
150150
$nextVersion = ($versionResult[0]['max_version'] ?? 0) + 1;
151151

152152
// Check if new content already exists
153-
$existingContent = new ModelObject('CronJobFunctionContent');
153+
$existingContent = new ModelObject(CronJobFunctionContent);
154154
$existingContent->retrieve('content_hash', $newContentHash);
155155

156156
if (!$existingContent->id) {
@@ -165,7 +165,7 @@ public function update($field, $value, $data)
165165
'date_created' => time()
166166
];
167167

168-
$contentObj = new ModelObject('CronJobFunctionContent');
168+
$contentObj = new ModelObject(CronJobFunctionContent);
169169
$contentObj->create($contentData, $this->api->user ? $this->api->user->id : null);
170170
} else {
171171
// Increment reference count
@@ -175,7 +175,7 @@ public function update($field, $value, $data)
175175

176176
// Decrement old content reference count
177177
if ($function->content_hash) {
178-
$oldContent = new ModelObject('CronJobFunctionContent');
178+
$oldContent = new ModelObject(CronJobFunctionContent);
179179
$oldContent->retrieve('content_hash', $function->content_hash);
180180
if ($oldContent->id && $oldContent->reference_count > 0) {
181181
$oldContent->reference_count--;

0 commit comments

Comments
 (0)