| @@ 446-457 (lines=12) @@ | ||
| 443 | * |
|
| 444 | * @throws \Exception |
|
| 445 | */ |
|
| 446 | public function deleteDocumentTypeBySlug($slug) |
|
| 447 | { |
|
| 448 | $documentTypes = $this->repository->documentTypes; |
|
| 449 | foreach ($documentTypes as $key => $documentTypeObject) { |
|
| 450 | if ($documentTypeObject->slug == $slug) { |
|
| 451 | unset($documentTypes[$key]); |
|
| 452 | } |
|
| 453 | } |
|
| 454 | $documentTypes = array_values($documentTypes); |
|
| 455 | $this->repository->documentTypes = $documentTypes; |
|
| 456 | $this->save(); |
|
| 457 | } |
|
| 458 | ||
| 459 | /** |
|
| 460 | * Get document type by its slug |
|
| @@ 498-510 (lines=13) @@ | ||
| 495 | * |
|
| 496 | * @throws \Exception |
|
| 497 | */ |
|
| 498 | public function saveDocumentType($slug, $postValues) |
|
| 499 | { |
|
| 500 | $documentTypeObject = DocumentTypeFactory::createDocumentTypeFromPostValues($postValues); |
|
| 501 | ||
| 502 | $documentTypes = $this->repository->documentTypes; |
|
| 503 | foreach ($documentTypes as $key => $documentType) { |
|
| 504 | if ($documentType->slug == $slug) { |
|
| 505 | $documentTypes[$key] = $documentTypeObject; |
|
| 506 | } |
|
| 507 | } |
|
| 508 | $this->repository->documentTypes = $documentTypes; |
|
| 509 | $this->save(); |
|
| 510 | } |
|
| 511 | ||
| 512 | /* |
|
| 513 | * |
|