예제 #1
0
 public function denormalize($data, $class, $format = null, array $context = [])
 {
     if (empty($data)) {
         return null;
     }
     if (isset($data->{'$ref'})) {
         return new Reference($data->{'$ref'}, $context['rootSchema'] ?: null);
     }
     $object = new \Joli\Jane\Tests\Expected\Model\Test();
     if (!isset($context['rootSchema'])) {
         $context['rootSchema'] = $object;
     }
     if (property_exists($data, 'onlyNull')) {
         $object->setOnlyNull($data->{'onlyNull'});
     }
     if (property_exists($data, 'nullOrString')) {
         $value = $data->{'nullOrString'};
         if (is_string($data->{'nullOrString'})) {
             $value = $data->{'nullOrString'};
         }
         if (is_null($data->{'nullOrString'})) {
             $value = $data->{'nullOrString'};
         }
         $object->setNullOrString($value);
     }
     return $object;
 }
예제 #2
0
 public function denormalize($data, $class, $format = null, array $context = [])
 {
     $object = new \Joli\Jane\Tests\Expected\Model\Test();
     if (property_exists($data, 'string')) {
         $object->setString($data->{'string'});
     }
     return $object;
 }
예제 #3
0
 public function denormalize($data, $class, $format = null, array $context = [])
 {
     $object = new \Joli\Jane\Tests\Expected\Model\Test();
     if (property_exists($data, 'child')) {
         $object->setChild($this->serializer->deserialize($data->{'child'}, 'Joli\\Jane\\Tests\\Expected\\Model\\Childtype', 'raw', $context));
     }
     if (property_exists($data, 'parent')) {
         $object->setParent($this->serializer->deserialize($data->{'parent'}, 'Joli\\Jane\\Tests\\Expected\\Model\\Parenttype', 'raw', $context));
     }
     return $object;
 }
예제 #4
0
 public function denormalize($data, $class, $format = null, array $context = [])
 {
     if (empty($data)) {
         return null;
     }
     if (isset($data->{'$ref'})) {
         return new Reference($data->{'$ref'}, $context['rootSchema'] ?: null);
     }
     $object = new \Joli\Jane\Tests\Expected\Model\Test();
     if (!isset($context['rootSchema'])) {
         $context['rootSchema'] = $object;
     }
     if (property_exists($data, 'date')) {
         $object->setDate(\DateTime::createFromFormat("Y-m-d\\TH:i:sP", $data->{'date'}));
     }
     return $object;
 }
예제 #5
0
 public function denormalize($data, $class, $format = null, array $context = [])
 {
     if (isset($data->{'$ref'})) {
         return new Reference($data->{'$ref'}, $context['rootSchema'] ?: null);
     }
     $object = new \Joli\Jane\Tests\Expected\Model\Test();
     if (!isset($context['rootSchema'])) {
         $context['rootSchema'] = $object;
     }
     if (property_exists($data, 'date')) {
         $object->setDate(\DateTime::createFromFormat('l, d-M-y H:i:s T', $data->{'date'}));
     }
     if (property_exists($data, 'dateOrNull')) {
         $value = $data->{'dateOrNull'};
         if (is_string($data->{'dateOrNull'}) and false !== \DateTime::createFromFormat('l, d-M-y H:i:s T', $data->{'dateOrNull'})) {
             $value = \DateTime::createFromFormat('l, d-M-y H:i:s T', $data->{'dateOrNull'});
         }
         if (is_null($data->{'dateOrNull'})) {
             $value = $data->{'dateOrNull'};
         }
         $object->setDateOrNull($value);
     }
     if (property_exists($data, 'dateOrNullOrInt')) {
         $value_1 = $data->{'dateOrNullOrInt'};
         if (is_string($data->{'dateOrNullOrInt'}) and false !== \DateTime::createFromFormat('l, d-M-y H:i:s T', $data->{'dateOrNullOrInt'})) {
             $value_1 = \DateTime::createFromFormat('l, d-M-y H:i:s T', $data->{'dateOrNullOrInt'});
         }
         if (is_null($data->{'dateOrNullOrInt'})) {
             $value_1 = $data->{'dateOrNullOrInt'};
         }
         if (is_int($data->{'dateOrNullOrInt'})) {
             $value_1 = $data->{'dateOrNullOrInt'};
         }
         $object->setDateOrNullOrInt($value_1);
     }
     return $object;
 }