Fix validation issue on links presentation creation
Change-Id: I64930ba1644cd27dd1ec8b29cb2d5c573ec0d85d
This commit is contained in:
parent
ca60f492df
commit
7492438d7a
|
@ -282,7 +282,7 @@ final class OAuth2PresentationApiController extends OAuth2ProtectedController
|
|||
'type_id' => 'required|integer',
|
||||
'track_id' => 'required|integer',
|
||||
'attending_media' => 'required|boolean',
|
||||
'links' => 'required|url_array',
|
||||
'links' => 'sometimes|url_array',
|
||||
'extra_questions' => 'sometimes|entity_value_array',
|
||||
];
|
||||
|
||||
|
|
|
@ -69,6 +69,8 @@ class Presentation extends SummitEvent
|
|||
|
||||
const ClassNamePresentation = 'Presentation';
|
||||
|
||||
const MaxAllowedLinks = 5;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="Level", type="string")
|
||||
* @var string
|
||||
|
|
|
@ -371,6 +371,15 @@ final class PresentationService
|
|||
|
||||
if (isset($data['links'])) {
|
||||
$presentation->clearLinks();
|
||||
|
||||
if(count($data['links']) > Presentation::MaxAllowedLinks){
|
||||
throw new ValidationException(trans(
|
||||
'validation_errors.PresentationService.saveOrUpdatePresentation.MaxAllowedLinks',
|
||||
[
|
||||
'max_allowed_links' => Presentation::MaxAllowedLinks
|
||||
]));
|
||||
}
|
||||
|
||||
foreach ($data['links'] as $link) {
|
||||
$presentationLink = new PresentationLink();
|
||||
$presentationLink->setName(trim($link));
|
||||
|
|
|
@ -83,6 +83,7 @@ return [
|
|||
'PresentationService.saveOrUpdatePresentation.notAvailableCFP' => 'type id :type_id is not a available for CFP',
|
||||
'PresentationService.saveOrUpdatePresentation.trackDontBelongToSelectionPlan' => 'track :track_id does not belongs to selection plan :selection_plan_id',
|
||||
'PresentationService.submitPresentation.limitReached' => 'You reached the limit :limit of presentations.',
|
||||
'PresentationService.saveOrUpdatePresentation.MaxAllowedLinks' => 'max. links quantity allowed is :max_allowed_links.',
|
||||
// organizations
|
||||
'OrganizationService.addOrganization.alreadyExistName' => 'Organization name :name already exists!',
|
||||
// track tag groups
|
||||
|
|
Loading…
Reference in New Issue