| @@ 703-714 (lines=12) @@ | ||
| 700 | * |
|
| 701 | * @throws \Exception |
|
| 702 | */ |
|
| 703 | public function deleteDocumentTypeBySlug($slug) |
|
| 704 | { |
|
| 705 | $documentTypes = $this->repository->documentTypes; |
|
| 706 | foreach ($documentTypes as $key => $documentTypeObject) { |
|
| 707 | if ($documentTypeObject->slug == $slug) { |
|
| 708 | unset($documentTypes[$key]); |
|
| 709 | } |
|
| 710 | } |
|
| 711 | $documentTypes = array_values($documentTypes); |
|
| 712 | $this->repository->documentTypes = $documentTypes; |
|
| 713 | $this->save(); |
|
| 714 | } |
|
| 715 | ||
| 716 | /** |
|
| 717 | * Get document type by its slug |
|
| @@ 755-767 (lines=13) @@ | ||
| 752 | * |
|
| 753 | * @throws \Exception |
|
| 754 | */ |
|
| 755 | public function saveDocumentType($slug, $postValues) |
|
| 756 | { |
|
| 757 | $documentTypeObject = DocumentTypeFactory::createDocumentTypeFromPostValues($postValues); |
|
| 758 | ||
| 759 | $documentTypes = $this->repository->documentTypes; |
|
| 760 | foreach ($documentTypes as $key => $documentType) { |
|
| 761 | if ($documentType->slug == $slug) { |
|
| 762 | $documentTypes[$key] = $documentTypeObject; |
|
| 763 | } |
|
| 764 | } |
|
| 765 | $this->repository->documentTypes = $documentTypes; |
|
| 766 | $this->save(); |
|
| 767 | } |
|
| 768 | ||
| 769 | /* |
|
| 770 | * |
|