mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-12 03:06:43 +02:00
fix(api): cast integers when creating episode
This commit is contained in:
parent
835ab8b248
commit
7ca501dd6f
1 changed files with 5 additions and 5 deletions
|
|
@ -95,7 +95,7 @@ class EpisodeController extends Controller
|
||||||
return $this->failValidationErrors(array_values($this->validator->getErrors()));
|
return $this->failValidationErrors(array_values($this->validator->getErrors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$podcastId = $this->request->getPost('podcast_id');
|
$podcastId = (int) $this->request->getPost('podcast_id');
|
||||||
|
|
||||||
$podcast = (new PodcastModel())->getPodcastById($podcastId);
|
$podcast = (new PodcastModel())->getPodcastById($podcastId);
|
||||||
|
|
||||||
|
|
@ -103,7 +103,7 @@ class EpisodeController extends Controller
|
||||||
return $this->failNotFound('Podcast not found');
|
return $this->failNotFound('Podcast not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$createdByUserId = $this->request->getPost('created_by');
|
$createdByUserId = (int) $this->request->getPost('created_by');
|
||||||
|
|
||||||
$userModel = new UserModel();
|
$userModel = new UserModel();
|
||||||
$createdByUser = $userModel->find($createdByUserId);
|
$createdByUser = $userModel->find($createdByUserId);
|
||||||
|
|
@ -112,7 +112,7 @@ class EpisodeController extends Controller
|
||||||
return $this->failNotFound('User not found');
|
return $this->failNotFound('User not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$updatedByUserId = $this->request->getPost('updated_by');
|
$updatedByUserId = (int) $this->request->getPost('updated_by');
|
||||||
|
|
||||||
$updatedByUser = $userModel->find($updatedByUserId);
|
$updatedByUser = $userModel->find($updatedByUserId);
|
||||||
|
|
||||||
|
|
@ -187,7 +187,7 @@ class EpisodeController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$episodeModel = new EpisodeModel();
|
$episodeModel = new EpisodeModel();
|
||||||
if (! ($newEpisodeId = $episodeModel->insert($newEpisode, true))) {
|
if (($newEpisodeId = (int) $episodeModel->insert($newEpisode, true)) === 0) {
|
||||||
return $this->fail($episodeModel->errors(), 400);
|
return $this->fail($episodeModel->errors(), 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -227,7 +227,7 @@ class EpisodeController extends Controller
|
||||||
return $this->failValidationErrors(array_values($this->validator->getErrors()));
|
return $this->failValidationErrors(array_values($this->validator->getErrors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$createdByUserId = $this->request->getPost('created_by');
|
$createdByUserId = (int) $this->request->getPost('created_by');
|
||||||
|
|
||||||
$userModel = new UserModel();
|
$userModel = new UserModel();
|
||||||
$createdByUser = $userModel->find($createdByUserId);
|
$createdByUser = $userModel->find($createdByUserId);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue