Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for publicationType before validating #149

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/Service/ValidationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public function __construct(
* Validate a publication to the definition defined in the PublicationType.
*
* @param Publication $publication The publication to validate.
* @return Publication The validated publication.
*
* @return array The validated publication.
*
* @throws DoesNotExistException
* @throws MultipleObjectsReturnedException
Expand All @@ -45,6 +46,10 @@ public function __construct(
*/
public function validatePublication(array $publication): array
{
if (isset($publication['publicationType']) === false) {
return $publication;
}

$publicationTypeId = $publication['publicationType'];
$publicationType = $this->objectService->getObject(objectType: 'publicationType', id: $publicationTypeId);

Expand Down