Code Duplication    Length = 9-9 lines in 2 locations

src/IPub/Forms/Forms/TEntityContainer.php 2 locations

@@ 97-105 (lines=9) @@
94
		foreach (self::iterate($formElement) as $name => $component) {
95
			if ($component instanceof Forms\IControl) {
96
				if (($classMetadata->hasField($name) || $classMetadata->hasAssociation($name)) && $value = $classMetadata->getFieldValue($entity, $name)) {
97
					if (is_object($value) && $this->isEntity($value)) {
98
						$UoW = $this->entityManager->getUnitOfWork();
99
						$value = $UoW->getSingleIdentifierValue($value);
100
101
						$component->setValue($value);
102
103
					} else {
104
						$component->setValue($value);
105
					}
106
107
				} else {
108
					$methodName = 'get' . ucfirst($name);
@@ 111-119 (lines=9) @@
108
					$methodName = 'get' . ucfirst($name);
109
110
					if (method_exists($entity, $methodName) && $value = call_user_func([$entity, $methodName])) {
111
						if (is_object($value) && $this->isEntity($value)) {
112
							$UoW = $this->entityManager->getUnitOfWork();
113
							$value = $UoW->getSingleIdentifierValue($value);
114
115
							$component->setValue($value);
116
117
						} else {
118
							$component->setValue($value);
119
						}
120
121
					} else {
122
						if ($erase) {