Skip to content

Commit

Permalink
Fixed bug that caused stack trace upon new callout
Browse files Browse the repository at this point in the history
EPO-6394
  • Loading branch information
ericdrosas87 committed Jun 9, 2022
1 parent 3dc6799 commit 618afa5
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions src/fields/DAMAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
namespace rosas\dam\fields;

use Craft;
// use craft\base\Field;
use craft\fields\Assets as AssetField;
use craft\base\ElementInterface;
use craft\helpers\Json;
use rosas\dam\controllers\AssetSyncController;
use rosas\dam\db\AssetMetadata;
use craft\gql\arguments\elements\Asset as AssetArguments;
//use craft\gql\interfaces\elements\Asset as AssetInterface;
use rosas\dam\gql\interfaces\DAMAssetInterface as AssetInterface;
//use craft\gql\resolvers\elements\Asset as AssetResolver;
use rosas\dam\gql\resolvers\DAMAssetResolver as AssetResolver;
use craft\helpers\Gql as GqlHelper;
use craft\services\Gql as GqlService;
Expand Down Expand Up @@ -83,25 +80,13 @@ public function getInputHtml($value, ElementInterface $element = null): string {
try {
if($element->damAsset != null) {
$assetId = $this->getDamAssetId($element->id);

Craft::info("About to compare assetId", "UDAMI");
Craft::info($assetId, "UDAMI");
Craft::info(Json::encode($assetId), "UDAMI");
if($assetId != null && is_array($assetId) && count($assetId) > 0) {
$assetId = $assetId[0];
Craft::info("about to log assetId inside of first IF", "UDAMI");
Craft::info($assetId, "UDAMI");
if($assetId != [] && $assetId != "[]" && is_int(intval($assetId))) { // value will likely come back as string, but may come back as "[]"
Craft::info("inside of the second IF!", "UDAMI");
$metadata = $this->getAssetMetadataByAssetId($assetId);
Craft::info("about to log metadata", "UDAMI");
Craft::info(Json::encode($metadata), "UDAMI");
$templateVals['assetId'] = $assetId;
} else {
Craft::info("did NOT pass second IF!!!", "UDAMI");
}
}
}

}
} catch(Exception $e) {
Craft::info($e, "error");
Expand Down Expand Up @@ -132,9 +117,6 @@ public static function getAssetMetadataByAssetId($assetId) {
->where(['"assetId"' => $assetId])
->all();

Craft::info("inside of getAssetMEtadataByAssetId", "UDAMI2");
Craft::info(Json::encode($rows), "UDAMI2");

$res = [];
$currentId = 0;
foreach($rows as $row) {
Expand All @@ -148,9 +130,6 @@ public static function getAssetMetadataByAssetId($assetId) {
}
}
}

Craft::info("about to log res", "UDAMI2");
Craft::info(Json::encode($res), "UDAMI2");
return $res;
}
}

0 comments on commit 618afa5

Please sign in to comment.