Skip to content

Commit

Permalink
Remove leftover debugging code
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-de-wit committed Nov 24, 2020
1 parent fca8246 commit 4966b97
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Directives/VariantDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,11 @@ public function manipulateArgDefinition(
FieldDefinitionNode &$parentField,
ObjectTypeDefinitionNode &$parentType
): void {
var_dump($parentType); exit;
$modelFQN = $parentType->directives[0]->arguments[0]->value->value;
die($modelFQN);
// Todo: Find a better way to determine the Model
$modelClass = $parentType->directives[0]->arguments[0]->value->value;

/** @var AttachmentInterface $model */
$model = new $modelFQN();
$model = new $modelClass();
$attribute = $parentField->name->value;

$availableVariants = $model->{$attribute}->variants();
Expand All @@ -55,7 +54,8 @@ public function manipulateArgDefinition(
// Check if the pre-defined variants actually exist.
$faulty = array_diff($allowedVariants, $availableVariants);
if (count($faulty)) {
throw new Exception('Variant(s) "' . implode('", "', $faulty) . '" are not available for attachment "' . $attribute . '" on model "' . $modelFQN . '"');
// Todo: Throw dedicated Exception./vendor/bin/php-cs-fixer fix --allow-risky=yes --show-progress=run-in --dry-run
throw new Exception('Variant(s) "' . implode('", "', $faulty) . '" are not available for attachment "' . $attribute . '" on model "' . $modelClass . '"');
}

$variants = $allowedVariants;
Expand Down

0 comments on commit 4966b97

Please sign in to comment.