| @@ 1030-1041 (lines=12) @@ | ||
| 1027 | * |
|
| 1028 | * @throws \Exception |
|
| 1029 | */ |
|
| 1030 | public function deleteDocumentTypeBySlug($slug) |
|
| 1031 | { |
|
| 1032 | $documentTypes = $this->repository->documentTypes; |
|
| 1033 | foreach ($documentTypes as $key => $documentTypeObject) { |
|
| 1034 | if ($documentTypeObject->slug == $slug) { |
|
| 1035 | unset($documentTypes[$key]); |
|
| 1036 | } |
|
| 1037 | } |
|
| 1038 | $documentTypes = array_values($documentTypes); |
|
| 1039 | $this->repository->documentTypes = $documentTypes; |
|
| 1040 | $this->save(); |
|
| 1041 | } |
|
| 1042 | ||
| 1043 | /** |
|
| 1044 | * Get document type by its slug |
|
| @@ 1080-1092 (lines=13) @@ | ||
| 1077 | * |
|
| 1078 | * @throws \Exception |
|
| 1079 | */ |
|
| 1080 | public function saveDocumentType($slug, $postValues) |
|
| 1081 | { |
|
| 1082 | $documentTypeObject = $this->createDocumentTypeFromPostValues($postValues); |
|
| 1083 | ||
| 1084 | $documentTypes = $this->repository->documentTypes; |
|
| 1085 | foreach ($documentTypes as $key => $documentType) { |
|
| 1086 | if ($documentType->slug == $slug) { |
|
| 1087 | $documentTypes[$key] = $documentTypeObject; |
|
| 1088 | } |
|
| 1089 | } |
|
| 1090 | $this->repository->documentTypes = $documentTypes; |
|
| 1091 | $this->save(); |
|
| 1092 | } |
|
| 1093 | ||
| 1094 | /* |
|
| 1095 | * |
|