Skip to content

Commit

Permalink
Adjust webhook notification controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Randy Čupić committed Sep 6, 2024
1 parent df94c92 commit 5a3fb41
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions bundle/Controller/Callback/Cloudinary/Notify.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Netgen\Bundle\RemoteMediaBundle\Controller\Callback\Cloudinary;

use Cloudinary\Api\NotFound;
use Cloudinary\Uploader;
use Cloudinary\Api\Exception\NotFound as CloudinaryNotFound;
use Cloudinary\Api\Upload\UploadApi;
use Doctrine\ORM\EntityManagerInterface;
use Netgen\RemoteMedia\API\ProviderInterface;
use Netgen\RemoteMedia\API\Values\RemoteResource;
Expand Down Expand Up @@ -197,14 +197,14 @@ private function handleResourceRenamed(array $requestContent): void
/** @var \Netgen\RemoteMedia\API\Values\RemoteResource $resource */
foreach ($result as $resource) {
try {
$apiResource = Uploader::explicit(
$apiResource = (new UploadApi())->explicit(
$requestContent['to_public_id'],
[
'type' => CloudinaryRemoteId::fromRemoteId($resource->getRemoteId())->getType(),
'resource_type' => CloudinaryRemoteId::fromRemoteId($resource->getRemoteId())->getResourceType(),
],
);
} catch (NotFound $e) {
} catch (CloudinaryNotFound $e) {
continue;
}

Expand Down Expand Up @@ -293,7 +293,7 @@ private function handleContextChanged(array $requestContent): void
$filenameFromUrl = basename($publicId);

try {
$apiResource = Uploader::explicit(
$apiResource = (new UploadApi())->explicit(
CloudinaryRemoteId::fromRemoteId($resource->getRemoteId())->getResourceId(),
[
'type' => CloudinaryRemoteId::fromRemoteId($resource->getRemoteId())->getType(),
Expand All @@ -302,7 +302,7 @@ private function handleContextChanged(array $requestContent): void
);

basename($apiResource['secure_url']);
} catch (NotFound $e) {
} catch (CloudinaryNotFound $e) {
continue;
}

Expand Down

0 comments on commit 5a3fb41

Please sign in to comment.