public function import($scope) { if (!$this->className) { throw new WrongStateException("no class defined for PrimitiveIdentifier '{$this->name}'"); } $className = $this->className; if (isset($scope[$this->name]) && $scope[$this->name] instanceof $className) { $value = $scope[$this->name]; $this->raw = $value->getId(); $this->setValue($value); return $this->imported = true; } $result = parent::import($scope); if ($result === true) { try { $result = $this->actualImportValue($this->value); Assert::isInstance($result, $className); $this->value = $result; return true; } catch (WrongArgumentException $e) { // not imported } catch (ObjectNotFoundException $e) { // not imported } $this->value = null; return false; } return $result; }
public function import($scope) { $result = parent::import($scope); if ($result === true) { try { $this->value = $this->makeEnumById($this->value); } catch (MissingElementException $e) { $this->value = null; return false; } return true; } return $result; }
public function import($scope) { if (!$this->className) { throw new WrongStateException("no class defined for PrimitiveEnumeration '{$this->name}'"); } $result = parent::import($scope); if ($result === true) { try { $this->value = new $this->className($this->value); } catch (MissingElementException $e) { $this->value = null; return false; } return true; } return $result; }