Пример #1
0
 /**
  * Converts a configurator option struct which used for default or selection configurators.
  *
  * @param StoreFrontBundle\Struct\Configurator\Group $group
  * @param StoreFrontBundle\Struct\Configurator\Option $option
  * @return array
  */
 public function convertConfiguratorOptionStruct(StoreFrontBundle\Struct\Configurator\Group $group, StoreFrontBundle\Struct\Configurator\Option $option)
 {
     $data = array('optionID' => $option->getId(), 'groupID' => $group->getId(), 'optionname' => $option->getName(), 'user_selected' => $option->isSelected(), 'selected' => $option->isSelected(), 'selectable' => $option->getActive());
     if ($option->getMedia()) {
         $data['media'] = $this->convertMediaStruct($option->getMedia());
     }
     return $data;
 }
Пример #2
0
 /**
  * @param array $data
  * @return Struct\Configurator\Option
  */
 private function createOption($data)
 {
     $option = new Struct\Configurator\Option();
     $translation = $this->getTranslation($data, '__configuratorOption_translation', '__configuratorOption_translation_fallback', ['name' => '__configuratorOption_name']);
     $data = array_merge($data, $translation);
     $option->setId((int) $data['__configuratorOption_id']);
     $option->setName($data['__configuratorOption_name']);
     return $option;
 }