mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
Switch to Symfony uid
This commit is contained in:
parent
6f4101ded3
commit
475250ca15
10 changed files with 28 additions and 32 deletions
|
|
@ -70,8 +70,6 @@
|
|||
"psr/http-client": "^1.0",
|
||||
"psr/http-message": "^1.0",
|
||||
"psr/log": "^2.0",
|
||||
"ramsey/uuid": "^4.0",
|
||||
"ramsey/uuid-doctrine": "^2.0",
|
||||
"sonata-project/block-bundle": "^4.2 || ^5.0",
|
||||
"stof/doctrine-extensions-bundle": "^1.4",
|
||||
"sylius-labs/association-hydrator": "^1.1 || ^1.2",
|
||||
|
|
@ -133,6 +131,7 @@
|
|||
"symfony/translation": "^6.4.0",
|
||||
"symfony/translation-contracts": "^2.5.2",
|
||||
"symfony/twig-bundle": "^6.4.0",
|
||||
"symfony/uid": "^6.4.0",
|
||||
"symfony/ux-autocomplete": "^2.17",
|
||||
"symfony/ux-live-component": "^2.17",
|
||||
"symfony/ux-twig-component": "^2.17",
|
||||
|
|
|
|||
4
config/packages/uid.yaml
Normal file
4
config/packages/uid.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
framework:
|
||||
uid:
|
||||
default_uuid_version: 7
|
||||
time_based_uuid_version: 7
|
||||
|
|
@ -25,7 +25,7 @@ final class Version20231106190918 extends AbstractMigration
|
|||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE TABLE sylius_payment_request (hash CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', method_id INT DEFAULT NULL, payment_id INT DEFAULT NULL, state VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, request_payload LONGTEXT NOT NULL COMMENT \'(DC2Type:object)\', response_data JSON NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, INDEX IDX_86D904B19883967 (method_id), INDEX IDX_86D904B4C3A3BB (payment_id), PRIMARY KEY(hash)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE sylius_payment_request (hash BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', method_id INT DEFAULT NULL, payment_id INT DEFAULT NULL, state VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, request_payload LONGTEXT NOT NULL COMMENT \'(DC2Type:object)\', response_data JSON NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, INDEX IDX_86D904B19883967 (method_id), INDEX IDX_86D904B4C3A3BB (payment_id), PRIMARY KEY(hash)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('ALTER TABLE sylius_payment_request ADD CONSTRAINT FK_86D904B19883967 FOREIGN KEY (method_id) REFERENCES sylius_payment_method (id)');
|
||||
$this->addSql('ALTER TABLE sylius_payment_request ADD CONSTRAINT FK_86D904B4C3A3BB FOREIGN KEY (payment_id) REFERENCES sylius_payment (id)');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,6 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Sylius Sp. z o.o.
|
||||
|
||||
parameters:
|
||||
sylius.uuid_type: Ramsey\Uuid\Doctrine\UuidType
|
||||
|
||||
doctrine:
|
||||
dbal:
|
||||
types:
|
||||
uuid: "%sylius.uuid_type%"
|
||||
|
||||
jms_serializer:
|
||||
metadata:
|
||||
directories:
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<mapped-superclass name="Sylius\Component\Payment\Model\PaymentRequest" table="sylius_payment_request">
|
||||
<id name="hash" column="hash" type="uuid">
|
||||
<generator strategy="CUSTOM" />
|
||||
<custom-id-generator class="Ramsey\Uuid\Doctrine\UuidGenerator"/>
|
||||
<custom-id-generator class="doctrine.uuid_generator"/>
|
||||
</id>
|
||||
|
||||
<many-to-one field="method" target-entity="Sylius\Component\Payment\Model\PaymentMethodInterface">
|
||||
|
|
|
|||
|
|
@ -29,9 +29,7 @@
|
|||
"php": "^8.2",
|
||||
"sylius/payment": "^2.0",
|
||||
"sylius/resource-bundle": "^1.10",
|
||||
"symfony/framework-bundle": "^6.4.1",
|
||||
"symfony/messenger": "^6.4.0",
|
||||
"ramsey/uuid-doctrine": "^2.0"
|
||||
"symfony/framework-bundle": "^6.4.1"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/orm": "2.15.2"
|
||||
|
|
|
|||
|
|
@ -14,12 +14,13 @@ declare(strict_types=1);
|
|||
namespace Sylius\Component\Payment\Model;
|
||||
|
||||
use Sylius\Component\Resource\Model\TimestampableTrait;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
|
||||
class PaymentRequest implements PaymentRequestInterface
|
||||
{
|
||||
use TimestampableTrait;
|
||||
|
||||
protected ?string $hash = null;
|
||||
protected ?Uuid $hash = null;
|
||||
|
||||
protected ?PaymentMethodInterface $method = null;
|
||||
|
||||
|
|
@ -40,10 +41,10 @@ class PaymentRequest implements PaymentRequestInterface
|
|||
|
||||
public function getId(): ?string
|
||||
{
|
||||
return $this->getHash();
|
||||
return $this->getHash()?->toBinary();
|
||||
}
|
||||
|
||||
public function getHash(): ?string
|
||||
public function getHash(): ?Uuid
|
||||
{
|
||||
return $this->hash;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ namespace Sylius\Component\Payment\Model;
|
|||
|
||||
use Sylius\Component\Resource\Model\ResourceInterface;
|
||||
use Sylius\Component\Resource\Model\TimestampableInterface;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
|
||||
interface PaymentRequestInterface extends TimestampableInterface, ResourceInterface
|
||||
{
|
||||
|
|
@ -40,7 +41,7 @@ interface PaymentRequestInterface extends TimestampableInterface, ResourceInterf
|
|||
|
||||
public const DATA_TYPE_PAYOUT = 'payout';
|
||||
|
||||
public function getHash(): ?string;
|
||||
public function getHash(): ?Uuid;
|
||||
|
||||
public function getMethod(): ?PaymentMethodInterface;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@
|
|||
"require": {
|
||||
"php": "^8.2",
|
||||
"sylius/registry": "^1.6",
|
||||
"sylius/resource": "^1.10"
|
||||
"sylius/resource": "^1.10",
|
||||
"symfony/uid": "^5.4.21 || ^6.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpspec/phpspec": "^7.2"
|
||||
|
|
|
|||
24
symfony.lock
24
symfony.lock
|
|
@ -466,18 +466,6 @@
|
|||
"ralouphie/getallheaders": {
|
||||
"version": "3.0.3"
|
||||
},
|
||||
"ramsey/uuid": {
|
||||
"version": "3.8.0"
|
||||
},
|
||||
"ramsey/uuid-doctrine": {
|
||||
"version": "2.0",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes-contrib",
|
||||
"branch": "main",
|
||||
"version": "1.3",
|
||||
"ref": "471aed0fbf5620b8d7f92b7a5ebbbf6c0945c27a"
|
||||
}
|
||||
},
|
||||
"rector/rector": {
|
||||
"version": "0.11.52"
|
||||
},
|
||||
|
|
@ -879,6 +867,18 @@
|
|||
"templates/base.html.twig"
|
||||
]
|
||||
},
|
||||
"symfony/uid": {
|
||||
"version": "6.4",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "6.2",
|
||||
"ref": "d294ad4add3e15d7eb1bae0221588ca89b38e558"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/uid.yaml"
|
||||
]
|
||||
},
|
||||
"symfony/ux-autocomplete": {
|
||||
"version": "2.9999999",
|
||||
"recipe": {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue