Skip to content

Commit

Permalink
Merge pull request #91 from commercetools/collection_discriminator
Browse files Browse the repository at this point in the history
  • Loading branch information
jenschude authored Aug 31, 2022
2 parents a9f2f8a + 620c747 commit b13230f
Showing 16 changed files with 172 additions and 30 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.1"
dependencies:
- highest

@@ -57,7 +57,7 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.1"
dependencies:
- highest

@@ -92,6 +92,7 @@ jobs:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php-version:
- "7.4"
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -67,11 +67,11 @@
"symfony/cache": "^3.0 || ^4.0 || ^5.0 || ^6.0"
},
"require-dev": {
"vimeo/psalm": "^3.10",
"vimeo/psalm": "^4.26",
"monolog/monolog": "^1.3",
"phpunit/phpunit": "^9.0 | 8.5.22",
"cache/array-adapter": "^1.0",
"symplify/easy-coding-standard": "dev-main#3723f5bad743e7cdff8c933ed6b29a2a936e9fbb"
"symplify/easy-coding-standard": "11.1.5"
},
"config": {
"allow-plugins": {
2 changes: 1 addition & 1 deletion ecs.php
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

ini_set("memory_limit", "-1");
use Commercetools\Tools\SummaryOnlyOutputFormatter;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use ECSPrefix202208\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
use Symplify\EasyCodingStandard\ValueObject\Option;

5 changes: 3 additions & 2 deletions lib/commercetools-api/src/Models/Message/MessageModel.php
Original file line number Diff line number Diff line change
@@ -210,7 +210,8 @@ public function __construct(
?int $sequenceNumber = null,
?Reference $resource = null,
?int $resourceVersion = null,
?UserProvidedIdentifiers $resourceUserProvidedIdentifiers = null
?UserProvidedIdentifiers $resourceUserProvidedIdentifiers = null,
?string $type = null
) {
$this->id = $id;
$this->version = $version;
@@ -222,7 +223,7 @@ public function __construct(
$this->resource = $resource;
$this->resourceVersion = $resourceVersion;
$this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
$this->type = static::DISCRIMINATOR_VALUE;
$this->type = $type;
}

/**
27 changes: 25 additions & 2 deletions lib/commercetools-api/src/Models/Message/OrderMessageModel.php
Original file line number Diff line number Diff line change
@@ -27,56 +27,67 @@
final class OrderMessageModel extends JsonObjectModel implements OrderMessage
{
/**
*
* @var ?string
*/
protected $id;

/**
*
* @var ?int
*/
protected $version;

/**
*
* @var ?DateTimeImmutable
*/
protected $createdAt;

/**
*
* @var ?DateTimeImmutable
*/
protected $lastModifiedAt;

/**
*
* @var ?LastModifiedBy
*/
protected $lastModifiedBy;

/**
*
* @var ?CreatedBy
*/
protected $createdBy;

/**
*
* @var ?int
*/
protected $sequenceNumber;

/**
*
* @var ?Reference
*/
protected $resource;

/**
*
* @var ?int
*/
protected $resourceVersion;

/**
*
* @var ?string
*/
protected $type;

/**
*
* @var ?UserProvidedIdentifiers
*/
protected $resourceUserProvidedIdentifiers;
@@ -95,7 +106,8 @@ public function __construct(
?int $sequenceNumber = null,
?Reference $resource = null,
?int $resourceVersion = null,
?UserProvidedIdentifiers $resourceUserProvidedIdentifiers = null
?UserProvidedIdentifiers $resourceUserProvidedIdentifiers = null,
?string $type = null
) {
$this->id = $id;
$this->version = $version;
@@ -107,12 +119,13 @@ public function __construct(
$this->resource = $resource;
$this->resourceVersion = $resourceVersion;
$this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
$this->type = static::DISCRIMINATOR_VALUE;
$this->type = $type;
}

/**
* <p>Unique identifier of the Message.</p>
*
*
* @return null|string
*/
public function getId()
@@ -130,6 +143,7 @@ public function getId()
}

/**
*
* @return null|int
*/
public function getVersion()
@@ -147,6 +161,7 @@ public function getVersion()
}

/**
*
* @return null|DateTimeImmutable
*/
public function getCreatedAt()
@@ -168,6 +183,7 @@ public function getCreatedAt()
}

/**
*
* @return null|DateTimeImmutable
*/
public function getLastModifiedAt()
@@ -191,6 +207,7 @@ public function getLastModifiedAt()
/**
* <p>Present on resources created after 1 February 2019 except for <a href="/client-logging#events-tracked">events not tracked</a>.</p>
*
*
* @return null|LastModifiedBy
*/
public function getLastModifiedBy()
@@ -211,6 +228,7 @@ public function getLastModifiedBy()
/**
* <p>Present on resources created after 1 February 2019 except for <a href="/client-logging#events-tracked">events not tracked</a>.</p>
*
*
* @return null|CreatedBy
*/
public function getCreatedBy()
@@ -229,6 +247,7 @@ public function getCreatedBy()
}

/**
*
* @return null|int
*/
public function getSequenceNumber()
@@ -248,6 +267,7 @@ public function getSequenceNumber()
/**
* <p>A Reference represents a loose reference to another resource in the same Project identified by its <code>id</code>. The <code>typeId</code> indicates the type of the referenced resource. Each resource type has its corresponding Reference type, like <a href="ctp:api:type:ChannelReference">ChannelReference</a>. A referenced resource can be embedded through <a href="/general-concepts#reference-expansion">Reference Expansion</a>. The expanded reference is the value of an additional <code>obj</code> field then.</p>
*
*
* @return null|Reference
*/
public function getResource()
@@ -266,6 +286,7 @@ public function getResource()
}

/**
*
* @return null|int
*/
public function getResourceVersion()
@@ -283,6 +304,7 @@ public function getResourceVersion()
}

/**
*
* @return null|string
*/
public function getType()
@@ -300,6 +322,7 @@ public function getType()
}

/**
*
* @return null|UserProvidedIdentifiers
*/
public function getResourceUserProvidedIdentifiers()
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@
final class OrderMessagePayloadModel extends JsonObjectModel implements OrderMessagePayload
{
/**
*
* @var ?string
*/
protected $type;
@@ -29,11 +30,13 @@ final class OrderMessagePayloadModel extends JsonObjectModel implements OrderMes
* @psalm-suppress MissingParamType
*/
public function __construct(
?string $type = null
) {
$this->type = static::DISCRIMINATOR_VALUE;
$this->type = $type;
}

/**
*
* @return null|string
*/
public function getType()
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ final class PaymentUpdateActionModel extends JsonObjectModel implements PaymentU
{
public const DISCRIMINATOR_VALUE = '';
/**
*
* @var ?string
*/
protected $action;
@@ -36,14 +37,10 @@ final class PaymentUpdateActionModel extends JsonObjectModel implements PaymentU
'changeTransactionInteractionId' => PaymentChangeTransactionInteractionIdActionModel::class,
'changeTransactionState' => PaymentChangeTransactionStateActionModel::class,
'changeTransactionTimestamp' => PaymentChangeTransactionTimestampActionModel::class,
'setAmountPaid' => PaymentSetAmountPaidActionModel::class,
'setAmountRefunded' => PaymentSetAmountRefundedActionModel::class,
'setAnonymousId' => PaymentSetAnonymousIdActionModel::class,
'setAuthorization' => PaymentSetAuthorizationActionModel::class,
'setCustomField' => PaymentSetCustomFieldActionModel::class,
'setCustomType' => PaymentSetCustomTypeActionModel::class,
'setCustomer' => PaymentSetCustomerActionModel::class,
'setExternalId' => PaymentSetExternalIdActionModel::class,
'setInterfaceId' => PaymentSetInterfaceIdActionModel::class,
'setKey' => PaymentSetKeyActionModel::class,
'setMethodInfoInterface' => PaymentSetMethodInfoInterfaceActionModel::class,
@@ -60,11 +57,13 @@ final class PaymentUpdateActionModel extends JsonObjectModel implements PaymentU
* @psalm-suppress MissingParamType
*/
public function __construct(
?string $action = null
) {
$this->action = static::DISCRIMINATOR_VALUE;
$this->action = $action;
}

/**
*
* @return null|string
*/
public function getAction()
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ final class ProductTypeUpdateActionModel extends JsonObjectModel implements Prod
{
public const DISCRIMINATOR_VALUE = '';
/**
*
* @var ?string
*/
protected $action;
@@ -35,7 +36,6 @@ final class ProductTypeUpdateActionModel extends JsonObjectModel implements Prod
'addPlainEnumValue' => ProductTypeAddPlainEnumValueActionModel::class,
'changeAttributeConstraint' => ProductTypeChangeAttributeConstraintActionModel::class,
'changeAttributeName' => ProductTypeChangeAttributeNameActionModel::class,
'changeAttributeOrder' => ProductTypeChangeAttributeOrderActionModel::class,
'changeAttributeOrderByName' => ProductTypeChangeAttributeOrderByNameActionModel::class,
'changeDescription' => ProductTypeChangeDescriptionActionModel::class,
'changeEnumKey' => ProductTypeChangeEnumKeyActionModel::class,
@@ -57,11 +57,13 @@ final class ProductTypeUpdateActionModel extends JsonObjectModel implements Prod
* @psalm-suppress MissingParamType
*/
public function __construct(
?string $action = null
) {
$this->action = static::DISCRIMINATOR_VALUE;
$this->action = $action;
}

/**
*
* @return null|string
*/
public function getAction()
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ final class ProjectUpdateActionModel extends JsonObjectModel implements ProjectU
{
public const DISCRIMINATOR_VALUE = '';
/**
*
* @var ?string
*/
protected $action;
@@ -36,7 +37,6 @@ final class ProjectUpdateActionModel extends JsonObjectModel implements ProjectU
'changeCurrencies' => ProjectChangeCurrenciesActionModel::class,
'changeLanguages' => ProjectChangeLanguagesActionModel::class,
'changeMessagesConfiguration' => ProjectChangeMessagesConfigurationActionModel::class,
'changeMessagesEnabled' => ProjectChangeMessagesEnabledActionModel::class,
'changeName' => ProjectChangeNameActionModel::class,
'changeOrderSearchStatus' => ProjectChangeOrderSearchStatusActionModel::class,
'changeProductSearchIndexingEnabled' => ProjectChangeProductSearchIndexingEnabledActionModel::class,
@@ -49,11 +49,13 @@ final class ProjectUpdateActionModel extends JsonObjectModel implements ProjectU
* @psalm-suppress MissingParamType
*/
public function __construct(
?string $action = null
) {
$this->action = static::DISCRIMINATOR_VALUE;
$this->action = $action;
}

/**
*
* @return null|string
*/
public function getAction()
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ final class TypeUpdateActionModel extends JsonObjectModel implements TypeUpdateA
{
public const DISCRIMINATOR_VALUE = '';
/**
*
* @var ?string
*/
protected $action;
@@ -35,7 +36,6 @@ final class TypeUpdateActionModel extends JsonObjectModel implements TypeUpdateA
'addLocalizedEnumValue' => TypeAddLocalizedEnumValueActionModel::class,
'changeEnumValueLabel' => TypeChangeEnumValueLabelActionModel::class,
'changeEnumValueOrder' => TypeChangeEnumValueOrderActionModel::class,
'changeFieldDefinitionLabel' => TypeChangeFieldDefinitionLabelActionModel::class,
'changeFieldDefinitionOrder' => TypeChangeFieldDefinitionOrderActionModel::class,
'changeInputHint' => TypeChangeInputHintActionModel::class,
'changeKey' => TypeChangeKeyActionModel::class,
@@ -51,11 +51,13 @@ final class TypeUpdateActionModel extends JsonObjectModel implements TypeUpdateA
* @psalm-suppress MissingParamType
*/
public function __construct(
?string $action = null
) {
$this->action = static::DISCRIMINATOR_VALUE;
$this->action = $action;
}

/**
*
* @return null|string
*/
public function getAction()
Loading

0 comments on commit b13230f

Please sign in to comment.