@@ 174-183 (lines=10) @@ | ||
171 | { |
|
172 | if ($this->isMultiUnitField($field)) { |
|
173 | $found = false; |
|
174 | foreach ($this->getMultiUnitFieldSupportedUnits($field) as $unitClass) { |
|
175 | /** |
|
176 | * @var AbstractUnit $unit |
|
177 | */ |
|
178 | $supportedUnit = new $unitClass(); |
|
179 | if (strtolower($supportedUnit->getId()) == strtolower($unit)) { |
|
180 | $found = true; |
|
181 | break; |
|
182 | } |
|
183 | } |
|
184 | if ($found) { |
|
185 | $this->multiUnitSelectedUnits[$field] = $unitClass; |
|
186 | } else { |
|
@@ 209-218 (lines=10) @@ | ||
206 | if (is_null($unit)) { |
|
207 | $unit = $this->getMultiUnitFieldUnit($field); |
|
208 | } else { |
|
209 | foreach ($this->getMultiUnitFieldSupportedUnits($field) as $unitClass) { |
|
210 | /** |
|
211 | * @var AbstractUnit $unit |
|
212 | */ |
|
213 | $supportedUnit = new $unitClass(); |
|
214 | if (strtolower($supportedUnit->getId()) == strtolower($unit)) { |
|
215 | $unit = $supportedUnit; |
|
216 | break; |
|
217 | } |
|
218 | } |
|
219 | } |
|
220 | if (is_string($unit)) { |
|
221 | throw new NotSupportedMultiUnitField($field); |