[API] Change the constructor signature of the AddProductReview command

This commit is contained in:
Rafikooo 2023-05-30 20:40:47 +02:00
parent 6f6bf56a4d
commit 09a5b65424
No known key found for this signature in database
GPG key ID: 4A26D8327BC2442B
2 changed files with 50 additions and 45 deletions

View file

@ -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}`

View file

@ -19,53 +19,13 @@ use Sylius\Bundle\ApiBundle\Command\IriToIdentifierConversionAwareInterface;
/** @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