Skip to content

Commit

Permalink
Extending create exception
Browse files Browse the repository at this point in the history
  • Loading branch information
akadlec committed Mar 24, 2020
1 parent 1d1d947 commit 263803c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions src/IPub/DoctrineCrud/Exceptions/EntityCreationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,31 @@

class EntityCreationException extends \RuntimeException implements IException
{

/**
* @var string
*/
private $field;

/**
* @param string $field
* @param string $message
* @param int $code
* @param \Exception|NULL $previous
*/
public function __construct(string $field, $message = '', $code = 0, \Exception $previous = null)
{
parent::__construct($message, $code, $previous);

$this->field = $field;
}

/**
* @return string
*/
public function getField(): string
{
return $this->field;
}

}
2 changes: 1 addition & 1 deletion src/IPub/DoctrineCrud/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static function autowireArguments(ReflectionMethod $method, array $argume
}
}

throw new Exceptions\EntityCreationException("Parameter \${$parameter->getName()} in $methodName has no class type hint or default value, so its value must be specified.");
throw new Exceptions\EntityCreationException($parameter->getName(), "Parameter \${$parameter->getName()} in $methodName has no class type hint or default value, so its value must be specified.");
}
}

Expand Down

0 comments on commit 263803c

Please sign in to comment.