Skip to content

Commit

Permalink
[API] Change the constructor signature of the AddProductReview command
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafikooo committed Jul 3, 2023
1 parent 6f6bf56 commit 09a5b65
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 45 deletions.
45 changes: 45 additions & 0 deletions UPGRADE-API-1.13.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
# UPGRADE FROM `v1.12.x` TO `v1.13.0`

1. The signature of constructor and `createFromData` method of 'Sylius\Bundle\ApiBundle\Command\Cart\ChangeItemQuantityCart' command changed:

````diff
public function __construct(
- public int $quantity,
+ public ?int $quantity,
) {
}
````

````diff
public static function createFromData(
string $tokenValue,
string $orderItemId,
- int $quantity,
+ ?int $quantity,
): self
````

1. The constructor signature of 'Sylius\Bundle\ApiBundle\Command\Cart\AddItemToCart' changed:

````diff
public function __construct(
- public string $productCode,
+ public ?string $productCode,
- public int $quantity,
+ public ?int $quantity,
) {
}
````

1. The constructor signature of `Sylius\Bundle\ApiBundle\Command\Catalog\AddProductReview` changed:

````diff
public function __construct(
public ?string $title,
public ?int $rating,
public ?string $comment,
- public string $productCode,
+ public ?string $productCode,
public ?string $email = null,
) {
}
````

1. The item operation paths for ProductVariantTranslation resource changed:

- `GET /admin/product-variant-translation/{id}` -> `GET /admin/product-variant-translations/{id}`
Expand Down
50 changes: 5 additions & 45 deletions src/Sylius/Bundle/ApiBundle/Command/Catalog/AddProductReview.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,53 +19,13 @@
/** @experimental */
class AddProductReview implements IriToIdentifierConversionAwareInterface, CustomerEmailAwareInterface
{
/**
* @psalm-immutable
*
* @var string|null
*/
public $title;

/**
* @psalm-immutable
*
* @var int|null
*/
public $rating;

/**
* @psalm-immutable
*
* @var string|null
*/
public $comment;

/**
* @psalm-immutable
*
* @var string
*/
public $productCode;

/**
* @psalm-immutable
*
* @var string|null
*/
public $email;

public function __construct(
?string $title,
?int $rating,
?string $comment,
string $productCode,
?string $email = null,
public ?string $title,
public ?int $rating,
public ?string $comment,
public ?string $productCode,
public ?string $email = null,
) {
$this->title = $title;
$this->rating = $rating;
$this->comment = $comment;
$this->productCode = $productCode;
$this->email = $email;
}

public function getEmail(): ?string
Expand Down

0 comments on commit 09a5b65

Please sign in to comment.