public function validateEdit(ValidationHook $hook)
 {
     $licenseIds = $this->requestStack->getCurrentRequest()->request->get('cmfcmfmediamodule[license]', [], true);
     $this->entities = [];
     $validationResponse = new ValidationResponse('license', $licenseIds);
     foreach ($licenseIds as $licenseId) {
         if (!empty($licenseId)) {
             $licenseEntity = $this->entityManager->find('CmfcmfMediaModule:License\\LicenseEntity', $licenseId);
             if (!is_object($licenseEntity)) {
                 $validationResponse->addError('license', $this->__('Unknown license'));
             } else {
                 $this->entities[] = $licenseEntity;
             }
         }
     }
     $hook->setValidator($this->getProvider(), $validationResponse);
 }
 public function validateEdit(ValidationHook $hook)
 {
     $request = $this->requestStack->getCurrentRequest()->request;
     $collectionIds = json_decode($request->get('cmfcmfmediamodule[collections]', "[]", true));
     $this->entities = [];
     $validationResponse = new ValidationResponse('collections', $collectionIds);
     foreach ($collectionIds as $collectionId) {
         if (!empty($collectionId)) {
             $collectionEntity = $this->entityManager->find('CmfcmfMediaModule:Collection\\CollectionEntity', $collectionId);
             if (!is_object($collectionEntity)) {
                 $validationResponse->addError('collections', $this->__('Unknown collection'));
             } else {
                 $this->entities[] = $collectionEntity;
             }
         }
     }
     $hook->setValidator($this->getProvider(), $validationResponse);
 }