| @@ 514-525 (lines=12) @@ | ||
| 511 | * |
|
| 512 | * @throws \Exception |
|
| 513 | */ |
|
| 514 | public function deleteDocumentTypeBySlug($slug) |
|
| 515 | { |
|
| 516 | $documentTypes = $this->repository->documentTypes; |
|
| 517 | foreach ($documentTypes as $key => $documentTypeObject) { |
|
| 518 | if ($documentTypeObject->slug == $slug) { |
|
| 519 | unset($documentTypes[$key]); |
|
| 520 | } |
|
| 521 | } |
|
| 522 | $documentTypes = array_values($documentTypes); |
|
| 523 | $this->repository->documentTypes = $documentTypes; |
|
| 524 | $this->save(); |
|
| 525 | } |
|
| 526 | ||
| 527 | /** |
|
| 528 | * Get document type by its slug |
|
| @@ 566-578 (lines=13) @@ | ||
| 563 | * |
|
| 564 | * @throws \Exception |
|
| 565 | */ |
|
| 566 | public function saveDocumentType($slug, $postValues) |
|
| 567 | { |
|
| 568 | $documentTypeObject = DocumentTypeFactory::createDocumentTypeFromPostValues($postValues); |
|
| 569 | ||
| 570 | $documentTypes = $this->repository->documentTypes; |
|
| 571 | foreach ($documentTypes as $key => $documentType) { |
|
| 572 | if ($documentType->slug == $slug) { |
|
| 573 | $documentTypes[$key] = $documentTypeObject; |
|
| 574 | } |
|
| 575 | } |
|
| 576 | $this->repository->documentTypes = $documentTypes; |
|
| 577 | $this->save(); |
|
| 578 | } |
|
| 579 | ||
| 580 | /* |
|
| 581 | * |
|