Esempio n. 1
0
 public function save(ClientProperties $client)
 {
     try {
         $formatter = Formatter::create(\MsiClient\Client::Formart_Request);
         if (!is_null($client->id)) {
             return $this->perform(['data' => $formatter->encode(['client' => $client->toArray()])], \MsiClient\Client::PUT_REQUEST, $this->getUrl() . '/' . $client->id);
         } else {
             return $this->perform(['data' => $formatter->encode(['client' => $client->toArray()])], \MsiClient\Client::POST_REQUEST);
         }
     } catch (ServerException $e) {
         throw $e;
     }
 }
 protected function fromJsonElement($elements)
 {
     parent::fromJsonElement($elements);
     $product = new ProductProperties();
     $this->product = [];
     if (isset($elements->product)) {
         $this->product = $product->fromJsonElement($elements->product);
     }
     unset($this->client_configuration);
     $this->product_configurations = [];
     if (isset($elements->client_configuration)) {
         foreach ($elements->client_configuration as $value) {
             $cConfg = new ClientProductConfigurationProperties();
             $this->product_configurations[] = $cConfg->fromJsonElement($value);
         }
     }
     if (isset($elements->client)) {
         unset($this->client);
         $this->client = [];
         $client = new ClientProperties();
         $this->client = $client->fromStdClass($elements->client);
     }
     return $this;
 }