protected function prepareRequest()
 {
     // if we're working with a cached result, we can only send specific fields
     $cacheKey = $this->get__cacheKey();
     $cacheLocation = $this->get__cacheLocation();
     $supplierType = $this->get__supplierType();
     if (isset($cacheKey, $cacheLocation)) {
         $this->xmlRequest->cacheKey = $cacheKey;
         $this->xmlRequest->cacheLocation = $cacheLocation;
         if (isset($supplierType)) {
             $this->xmlRequest->supplierType = $supplierType;
         }
         return;
     }
     // not working with a cached result, so just prepare the request per usual
     if (isset($this->searchMethod)) {
         $searchMethodProperties = $this->searchMethod->renderPreparedArray();
         foreach ($searchMethodProperties as $tag => $value) {
             $this->xmlRequest->addChild($tag, (string) $value);
         }
     }
     foreach (self::$propertyMap as $property => $type) {
         if (!isset($this->{$property})) {
             continue;
         }
         switch ($type) {
             case 'DateTime':
                 $this->xmlRequest->{$property} = $this->{$property}->format('m/d/Y');
                 break;
             case 'EANRoomGroup':
                 XMLUtils::appendSXE($this->xmlRequest, $this->{$property}->xml);
                 break;
             case 'int':
             case 'float':
             case 'string':
                 if (method_exists($this, 'get__' . $property)) {
                     $this->xmlRequest->{$property} = $this->{'get__' . $property}();
                 } else {
                     $this->xmlRequest->{$property} = (string) $this->{$property};
                 }
                 break;
             case 'boolean':
                 $this->xmlRequest->{$property} = $this->{$property} ? 'true' : 'false';
                 break;
         }
     }
 }
 public function refreshXML()
 {
     $this->xml = new SimpleXMLElement('<' . static::$ROOT . ' />');
     if (isset(static::$attributeMap) && is_array(static::$attributeMap)) {
         foreach (static::$attributeMap as $attribute => $type) {
             $this->xml->addAttribute($attribute, (string) $this->{$attribute});
         }
     }
     foreach ($this->items as $item) {
         /* @var $item EANAbstractSupportModel */
         if (method_exists($item, 'refreshXML')) {
             $item->refreshXML();
         }
         XMLUtils::appendSXE($this->xml, $item->xml);
     }
 }
 protected function prepareRequest()
 {
     foreach (self::$propertyMap as $property => $type) {
         if (!isset($this->{$property})) {
             continue;
         }
         switch ($type) {
             case 'DateTime':
                 $this->xmlRequest->{$property} = $this->{$property}->format('m/d/Y');
                 break;
             case 'EANReservationAddress':
             case 'EANReservationInfo':
             case 'EANRoomGroup':
                 $this->{$property}->refreshXML();
                 XMLUtils::appendSXE($this->xmlRequest, $this->{$property}->xml);
                 break;
             case 'int':
             case 'float':
             case 'string':
                 if (method_exists($this, 'get__' . $property)) {
                     $this->xmlRequest->{$property} = $this->{'get__' . $property}();
                 } else {
                     $this->xmlRequest->{$property} = (string) $this->{$property};
                 }
                 break;
             case 'boolean':
                 $this->xmlRequest->{$property} = $this->{$property} ? 'true' : 'false';
                 break;
         }
     }
 }