| @@ 212-221 (lines=10) @@ | ||
| 209 | { |
|
| 210 | if ($this->isMultiUnitField($field)) { |
|
| 211 | $found = false; |
|
| 212 | foreach ($this->getMultiUnitFieldSupportedUnits($field) as $unitClass) { |
|
| 213 | /** |
|
| 214 | * @var AbstractUnit $unit |
|
| 215 | */ |
|
| 216 | $supportedUnit = new $unitClass(); |
|
| 217 | if (strtolower($supportedUnit->getId()) == strtolower($unit)) { |
|
| 218 | $found = true; |
|
| 219 | break; |
|
| 220 | } |
|
| 221 | } |
|
| 222 | if($found) |
|
| 223 | $this->multiUnitSelectedUnits[$field] = $unitClass; |
|
| 224 | else |
|
| @@ 247-256 (lines=10) @@ | ||
| 244 | if (is_null($unit)) { |
|
| 245 | $unit = $this->getMultiUnitFieldUnit($field); |
|
| 246 | } else { |
|
| 247 | foreach ($this->getMultiUnitFieldSupportedUnits($field) as $unitClass) { |
|
| 248 | /** |
|
| 249 | * @var AbstractUnit $unit |
|
| 250 | */ |
|
| 251 | $supportedUnit = new $unitClass(); |
|
| 252 | if (strtolower($supportedUnit->getId()) == strtolower($unit)) { |
|
| 253 | $unit = $supportedUnit; |
|
| 254 | break; |
|
| 255 | } |
|
| 256 | } |
|
| 257 | } |
|
| 258 | if (is_string($unit)) { |
|
| 259 | throw new NotSupportedMultiUnitField($field); |
|