[PHP] Fix discriminator handling (#4246)

* [PHP] Fix discriminator handling

* [PHP] Fix discriminator handling (Update examples)
This commit is contained in:
Robert Biehl
2016-11-25 09:12:41 +01:00
committed by wing328
parent c15743bfe6
commit 1ea9865a44
42 changed files with 216 additions and 119 deletions

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class AdditionalPropertiesClass implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class Animal implements ArrayAccess
{
const DISCRIMINATOR = 'className';
/**
* The original name of the model.
* @var string
@@ -126,8 +128,8 @@ class Animal implements ArrayAccess
$this->container['color'] = isset($data['color']) ? $data['color'] : 'red';
// Initialize discriminator property with the model name.
$discrimintor = array_search('className', self::$attributeMap);
$this->container[$discrimintor] = static::$swaggerModelName;
$discriminator = array_search('className', self::$attributeMap);
$this->container[$discriminator] = static::$swaggerModelName;
}
/**

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class AnimalFarm implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class ApiResponse implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class ArrayOfArrayOfNumberOnly implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class ArrayOfNumberOnly implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class ArrayTest implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class Cat extends Animal implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class Category implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class Client implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class Dog extends Animal implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class EnumArrays implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class EnumTest implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class FormatTest implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class HasOnlyReadOnly implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class MapTest implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class MixedPropertiesAndAdditionalPropertiesClass implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -43,6 +43,8 @@ use \ArrayAccess;
*/
class Model200Response implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class ModelList implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -43,6 +43,8 @@ use \ArrayAccess;
*/
class ModelReturn implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -43,6 +43,8 @@ use \ArrayAccess;
*/
class Name implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class NumberOnly implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class Order implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class Pet implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class ReadOnlyFirst implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class SpecialModelName implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class Tag implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string

View File

@@ -42,6 +42,8 @@ use \ArrayAccess;
*/
class User implements ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
* @var string