| @@ 606-617 (lines=12) @@ | ||
| 603 | * |
|
| 604 | * @throws \Exception |
|
| 605 | */ |
|
| 606 | public function deleteDocumentTypeBySlug($slug) |
|
| 607 | { |
|
| 608 | $documentTypes = $this->repository->documentTypes; |
|
| 609 | foreach ($documentTypes as $key => $documentTypeObject) { |
|
| 610 | if ($documentTypeObject->slug == $slug) { |
|
| 611 | unset($documentTypes[$key]); |
|
| 612 | } |
|
| 613 | } |
|
| 614 | $documentTypes = array_values($documentTypes); |
|
| 615 | $this->repository->documentTypes = $documentTypes; |
|
| 616 | $this->save(); |
|
| 617 | } |
|
| 618 | ||
| 619 | /** |
|
| 620 | * Get document type by its slug |
|
| @@ 658-670 (lines=13) @@ | ||
| 655 | * |
|
| 656 | * @throws \Exception |
|
| 657 | */ |
|
| 658 | public function saveDocumentType($slug, $postValues) |
|
| 659 | { |
|
| 660 | $documentTypeObject = DocumentTypeFactory::createDocumentTypeFromPostValues($postValues); |
|
| 661 | ||
| 662 | $documentTypes = $this->repository->documentTypes; |
|
| 663 | foreach ($documentTypes as $key => $documentType) { |
|
| 664 | if ($documentType->slug == $slug) { |
|
| 665 | $documentTypes[$key] = $documentTypeObject; |
|
| 666 | } |
|
| 667 | } |
|
| 668 | $this->repository->documentTypes = $documentTypes; |
|
| 669 | $this->save(); |
|
| 670 | } |
|
| 671 | ||
| 672 | /* |
|
| 673 | * |
|