getContext in save options
This commit is contained in:
@@ -29,7 +29,9 @@
|
||||
|
||||
namespace Espo\ORM\Repository\Option;
|
||||
|
||||
use Espo\Core\ORM\Repository\Option\SaveContext;
|
||||
use Espo\ORM\Repository\Option\Traits\Options;
|
||||
use UnexpectedValueException;
|
||||
|
||||
/**
|
||||
* Save options.
|
||||
@@ -39,4 +41,18 @@ use Espo\ORM\Repository\Option\Traits\Options;
|
||||
class SaveOptions
|
||||
{
|
||||
use Options;
|
||||
|
||||
/**
|
||||
* @since 9.4.0
|
||||
*/
|
||||
public function getContext(): SaveContext
|
||||
{
|
||||
$context = $this->get(SaveContext::NAME);
|
||||
|
||||
if (!$context instanceof SaveContext) {
|
||||
throw new UnexpectedValueException("No or bad 'context'.");
|
||||
}
|
||||
|
||||
return $context;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user