From 4a6b5e881be32e43d97b7af3f33344d78ff90783 Mon Sep 17 00:00:00 2001 From: Ishiki Date: Mon, 23 Sep 2019 18:52:47 +0300 Subject: [PATCH] WorflowEntityValidator allow object If entity contains some object rather than entity and it goes to validator it throws not manageable error. We have lots of DataTypes in our code. This is just an unnecessary restriction. --- .../Validator/Constraints/WorkflowEntityValidator.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Oro/Bundle/WorkflowBundle/Validator/Constraints/WorkflowEntityValidator.php b/src/Oro/Bundle/WorkflowBundle/Validator/Constraints/WorkflowEntityValidator.php index ff132699003..a4cc86506fc 100644 --- a/src/Oro/Bundle/WorkflowBundle/Validator/Constraints/WorkflowEntityValidator.php +++ b/src/Oro/Bundle/WorkflowBundle/Validator/Constraints/WorkflowEntityValidator.php @@ -198,7 +198,9 @@ protected function validateAllowedValues($object, $message, $restriction) { $fieldValue = $this->propertyAccessor->getValue($object, $restriction['field']); if (is_object($fieldValue)) { - $fieldValue = $this->doctrineHelper->getSingleEntityIdentifier($fieldValue); + $fieldValue = $this->doctrineHelper->isManageableEntity($fieldValue) ? + $this->doctrineHelper->getSingleEntityIdentifier($fieldValue) : + (string)$fieldValue; } if ($restriction['mode'] === 'allow') {