| @@ 813-824 (lines=12) @@ | ||
| 810 | * |
|
| 811 | * @throws \Exception |
|
| 812 | */ |
|
| 813 | public function deleteDocumentTypeBySlug($slug) |
|
| 814 | { |
|
| 815 | $documentTypes = $this->repository->documentTypes; |
|
| 816 | foreach ($documentTypes as $key => $documentTypeObject) { |
|
| 817 | if ($documentTypeObject->slug == $slug) { |
|
| 818 | unset($documentTypes[$key]); |
|
| 819 | } |
|
| 820 | } |
|
| 821 | $documentTypes = array_values($documentTypes); |
|
| 822 | $this->repository->documentTypes = $documentTypes; |
|
| 823 | $this->save(); |
|
| 824 | } |
|
| 825 | ||
| 826 | /** |
|
| 827 | * Get document type by its slug |
|
| @@ 863-875 (lines=13) @@ | ||
| 860 | * |
|
| 861 | * @throws \Exception |
|
| 862 | */ |
|
| 863 | public function saveDocumentType($slug, $postValues) |
|
| 864 | { |
|
| 865 | $documentTypeObject = $this->createDocumentTypeFromPostValues($postValues); |
|
| 866 | ||
| 867 | $documentTypes = $this->repository->documentTypes; |
|
| 868 | foreach ($documentTypes as $key => $documentType) { |
|
| 869 | if ($documentType->slug == $slug) { |
|
| 870 | $documentTypes[$key] = $documentTypeObject; |
|
| 871 | } |
|
| 872 | } |
|
| 873 | $this->repository->documentTypes = $documentTypes; |
|
| 874 | $this->save(); |
|
| 875 | } |
|
| 876 | ||
| 877 | /* |
|
| 878 | * |
|