Programming Language PHP
Namespace Oro\Component\ChainProcessor
Class ContextInterface
Method/Function removeResult
Total Examples 4
4 code examples of PHP Oro\Component\ChainProcessor\ContextInterface::removeResult extracted from open source projects
/**
* @inheritdoc
*/
public function process(ContextInterface $context)
{
$context->removeResult();
}
/**
* @inheritdoc
*/
public function process(ContextInterface $context)
{
/** @var Context $context */
if (!$context->hasResult()) {
return;
}
$exception = $context->getResult();
if (!$exception instanceof \Throwable) {
throw new RuntimeException(sprintf(
'The result should be an instance of Throwable, "%s" given.',
\is_object($exception) ? \get_class($exception) : gettype($exception)
));
}
if (!$exception instanceof \Exception) {
$exception = new \ErrorException(
$exception->getMessage(),
$exception->getCode(),
E_ERROR,
$exception->getFile(),
$exception->getLine(),
$exception
);
}
$context->addError(Error::createByException($exception));
$context->removeResult();
}
/**
* @inheritdoc
*/
public function process(ContextInterface $context)
{
/** @var Context $context */
if (!$context->hasResult()) {
// result deleted or not supported
return;
}
$entityClass = $context->getManageableEntityClass($this->doctrineHelper);
if (!$entityClass) {
// only manageable entities or resources based on manageable entities are supported
return;
}
$deleteHandler = $this->deleteHandlerRegistry->getHandler($entityClass);
$this->processDelete($context->getResult(), $deleteHandler, $entityClass);
$context->removeResult();
}
/**
* @inheritdoc
*/
public function process(ContextInterface $context)
{
/** @var Context $context */
if (!$context->hasResult()) {
// result deleted or not supported
return;
}
$entityClass = $context->getManageableEntityClass($this->doctrineHelper);
if (!$entityClass) {
// only manageable entities or resources based on manageable entities are supported
return;
}
$deleteHandler = $this->deleteHandlerRegistry->getHandler($entityClass);
$this->processDelete($context->getResult(), $deleteHandler);
$context->removeResult();
}