| @@ 92-113 (lines=22) @@ | ||
| 89 | * |
|
| 90 | * @throws NotFoundException |
|
| 91 | */ |
|
| 92 | public function find(ValueObject $object, $throwException = false) |
|
| 93 | { |
|
| 94 | if (isset($object->data['identifier'])) { |
|
| 95 | try { |
|
| 96 | $contentType = $this->contentTypeService->loadContentTypeByIdentifier($object->data['identifier']); |
|
| 97 | } catch (NotFoundException $notFoundException) { |
|
| 98 | $exception = $notFoundException; |
|
| 99 | } |
|
| 100 | } |
|
| 101 | ||
| 102 | if (!isset($contentType)) { |
|
| 103 | if (isset($exception) && $throwException) { |
|
| 104 | throw $exception; |
|
| 105 | } |
|
| 106 | ||
| 107 | return false; |
|
| 108 | } |
|
| 109 | ||
| 110 | return $contentType; |
|
| 111 | } |
|
| 112 | ||
| 113 | /** |
|
| 114 | * {@inheritdoc} |
|
| 115 | */ |
|
| 116 | public function create(ObjectInterface $object) |
|
| @@ 80-99 (lines=20) @@ | ||
| 77 | * |
|
| 78 | * @throws NotFoundException |
|
| 79 | */ |
|
| 80 | public function find(ValueObject $object, $throwExceptions = false) |
|
| 81 | { |
|
| 82 | if (isset($object->data['code'])) { |
|
| 83 | try { |
|
| 84 | $language = $this->languageService->loadLanguage($object->data['code']); |
|
| 85 | } catch (NotFoundException $notFoundException) { |
|
| 86 | $exception = $notFoundException; |
|
| 87 | } |
|
| 88 | } |
|
| 89 | ||
| 90 | if (!isset($language)) { |
|
| 91 | if (isset($exception) && $throwExceptions) { |
|
| 92 | throw $exception; |
|
| 93 | } |
|
| 94 | ||
| 95 | return false; |
|
| 96 | } |
|
| 97 | ||
| 98 | return $language; |
|
| 99 | } |
|
| 100 | ||
| 101 | /** |
|
| 102 | * {@inheritdoc} |
|
| @@ 86-105 (lines=20) @@ | ||
| 83 | * |
|
| 84 | * @throws NotFoundException |
|
| 85 | */ |
|
| 86 | public function find(ValueObject $object, $throwException = false) |
|
| 87 | { |
|
| 88 | try { |
|
| 89 | if (isset($object->data['username'])) { |
|
| 90 | $user = $this->userService->loadUserByLogin($object->data['username']); |
|
| 91 | } |
|
| 92 | } catch (NotFoundException $notFoundException) { |
|
| 93 | $exception = $notFoundException; |
|
| 94 | } |
|
| 95 | ||
| 96 | if (!isset($user)) { |
|
| 97 | if (isset($exception) && $throwException) { |
|
| 98 | throw $exception; |
|
| 99 | } |
|
| 100 | ||
| 101 | return false; |
|
| 102 | } |
|
| 103 | ||
| 104 | return $user; |
|
| 105 | } |
|
| 106 | ||
| 107 | /** |
|
| 108 | * {@inheritdoc} |
|