/**
  * {@inheritdoc}
  */
 public function validate($value, Constraint $constraint)
 {
     if (null === $value) {
         return;
     }
     if (!is_array($value) || !$value instanceof \Traversable) {
         if ($this->context instanceof ExecutionContextInterface) {
             $this->context->buildViolation($constraint->messageList)->setParameter('{{ type }}', is_object($value) ? get_class($value) : gettype($value))->setInvalidValue($value)->addViolation();
         } else {
             $this->buildViolation($constraint->messageList)->setParameter('{{ type }}', is_object($value) ? get_class($value) : gettype($value))->setInvalidValue($value)->addViolation();
         }
     }
     $validCodes = [];
     foreach ($this->attributeManager->getAttributes('pim_catalog_image') as $attribute) {
         $validCodes[] = $attribute->getCode();
     }
     foreach ($value as $code) {
         if (!in_array($code, $validCodes)) {
             if ($this->context instanceof ExecutionContextInterface) {
                 $this->context->buildViolation($constraint->message)->setParameter('{{ code }}', $code)->setInvalidValue($code)->addViolation();
             } else {
                 $this->buildViolation($constraint->message)->setParameter('{{ code }}', $code)->setInvalidValue($code)->addViolation();
             }
             return;
         }
     }
 }
 /**
  * {@inheritdoc}
  */
 public function validate($value, Constraint $constraint)
 {
     if (null === $value) {
         return;
     }
     foreach ($this->attributeManager->getAttributes('pim_catalog_image') as $attribute) {
         if ($attribute->getCode() === $value) {
             return;
         }
     }
     if ($this->context instanceof ExecutionContextInterface) {
         $this->context->buildViolation($constraint->message)->setParameter('{{ code }}', $value)->setInvalidValue($value)->addViolation();
     } else {
         $this->buildViolation($constraint->message)->setParameter('{{ code }}', $value)->setInvalidValue($value)->addViolation();
     }
 }
 /**
  * @param JobInstance $jobInstance
  * @return array
  */
 public function getFormConfiguration(JobInstance $jobInstance)
 {
     return ['imageAttribute' => ['type' => 'choice', 'options' => ['choices' => $this->attributeManager->getAttributeChoices('pim_catalog_image'), 'required' => true, 'select2' => true, 'label' => 'luni_assets.steps.gallery.processor.imageAttribute.label', 'help' => 'luni_assets.steps.gallery.processor.imageAttribute.help']], 'thumbnailAttribute' => ['type' => 'choice', 'options' => ['choices' => $this->attributeManager->getAttributeChoices('pim_catalog_image'), 'required' => true, 'select2' => true, 'label' => 'luni_assets.steps.gallery.processor.thumbnailAttribute.label', 'help' => 'luni_assets.steps.gallery.processor.thumbnailAttribute.help']], 'smallImageAttribute' => ['type' => 'choice', 'options' => ['choices' => $this->attributeManager->getAttributeChoices('pim_catalog_image'), 'required' => true, 'select2' => true, 'label' => 'luni_assets.steps.gallery.processor.smallImageAttribute.label', 'help' => 'luni_assets.steps.gallery.processor.smallImageAttribute.help']], 'galleryAttributes' => ['type' => 'choice', 'options' => ['choices' => $this->attributeManager->getAttributeChoices('pim_catalog_image'), 'required' => true, 'select2' => true, 'multiple' => true, 'label' => 'luni_assets.steps.gallery.processor.galleryAttributes.label', 'help' => 'luni_assets.steps.gallery.processor.galleryAttributes.help']]];
 }