/**
  * create type mapping object
  *
  * @param array $indexConfig
  * @return Mapping
  */
 protected function createMapping($indexConfig)
 {
     /*$mapping = $this->createMapping($indexConfig['config']['properties'][$typeName]);*/
     $mapping = Mapping::create($indexConfig['properties']);
     $mappingSpecialFields = array('_uid', '_id', '_source', '_all', '_analyzer', '_boost', '_routing', '_index', '_size', '_timestamp', '_ttl', 'dynamic_templates');
     foreach ($mappingSpecialFields as $specialField) {
         if (isset($indexConfig[$specialField])) {
             $mapping->setParam($specialField, $indexConfig[$specialField]);
         }
     }
     if (isset($indexConfig['_parent'])) {
         $mapping->setParam('_parent', array('type' => $indexConfig['_parent']['type']));
     }
     return $mapping;
 }
Esempio n. 2
0
 public function fromServiceData($properties)
 {
     $properties = (array) $properties;
     if ($this->_order) {
         $this->_order->setCountryIso($properties['country_iso']);
         $this->_order->setCityPrefix($properties['city_prefix']);
         $this->_order->setAutorenewEnable($properties['autorenew_enable']);
         // only URI supporting
         if (preg_match("/^URI:(\\w+)\\/(\\S+)\$/", $properties['did_mapping_format'], $matches)) {
             if (count($matches) == 3) {
                 $mapping = Mapping::create(array("map_type" => 'URI', "map_proto" => $matches[1], "map_detail" => $matches[2]));
                 $this->_order->setMapData($mapping);
             }
         }
     }
     unset($properties['city_prefix'], $properties['country_iso'], $properties['autorenew_enable']);
     $assignType = $this->getAssignType();
     $this->setAssignType(\Didww\API2\Object::ASSIGN_IGNORE);
     $this->fromArray($properties);
     $this->setAssignType($assignType);
 }
Esempio n. 3
0
 public function fromServiceData($properties)
 {
     $properties = (array) $properties;
     if ($this->_order) {
         $this->_order->setCountryIso($properties['country_iso']);
         $this->_order->setCityPrefix($properties['city_prefix']);
         $this->_order->setAutorenewEnable($properties['autorenew_enable']);
         $mappingVars = explode(":", $properties['did_mapping_format']);
         if (count($mappingVars) == 3) {
             $mapping = Mapping::create(array("map_type" => $mappingVars[0], "map_proto" => $mappingVars[1], "map_detail" => $mappingVars[2]));
             $this->_order->setMapData($mapping);
         }
     }
     unset($properties['city_prefix'], $properties['country_iso'], $properties['autorenew_enable']);
     $assignType = $this->getAssignType();
     $this->setAssignType(\Didww\API2\Object::ASSIGN_IGNORE);
     $this->fromArray($properties);
     $this->setAssignType($assignType);
 }
Esempio n. 4
0
 /**
  * create object from  array
  * @see parent::fromArray
  * @param array $array
  */
 public function fromArray($array)
 {
     if (!empty($array['number'])) {
         $this->_ensureNumber()->fromArray($array['number']);
         unset($array['number']);
     }
     if (!empty($array['map_data'])) {
         $this->setMapData(Mapping::create($array['map_data']));
         unset($array['map_data']);
     }
     parent::fromArray($array);
 }