You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Delete a model by its primary key or throw an exception.
*
* @param int|string $id
*
* @throws ModelNotFoundException
* @throws DeleteResourceFailedException
*/
publicfunctiondelete($id): bool
{
try {
return (bool) parent::delete($id);
} catch (\Exception) {
thrownewDeleteResourceFailedException();
}
}
Maybe it makes sense to catch ModelNotFoundException and in this case return false from the delete function (similar to other methods that return empty data)?
Or catch ModelNotFoundException and throw NotFoundException to indicate that the requested model is not available for deletion.
Apiato Version
12.4.1
PHP Version
8.3
Database Driver & Version
No response
Description
Exception ModelNotFoundException is never thrown in this method, but the phpdoc says it can be thrown.
apiato/app/Ship/Parents/Repositories/Repository.php
Lines 58 to 73 in 46b8001
Maybe it makes sense to catch ModelNotFoundException and in this case return false from the delete function (similar to other methods that return empty data)?
Or catch ModelNotFoundException and throw NotFoundException to indicate that the requested model is not available for deletion.
apiato/app/Ship/Exceptions/NotFoundException.php
Lines 3 to 12 in 46b8001
Steps To Reproduce
The text was updated successfully, but these errors were encountered: