Skip to content

Using UuidInterface everywhere is painful #89

@pdt256

Description

@pdt256

The Uuid and UuidInterface classes do not offer much value in kommerce-core. They are only used to generate a uuid4 value and to convert from hex to bytes using the getBytes() method.

Example command converting a string to Uuid:

AddTagToProductCommand

final class AddTagToProductCommand implements CommandInterface
{
    /** @var UuidInterface */
    private $productId;

    /** @var UuidInterface */
    private $tagId;

    /**
     * @param string $productId
     * @param string $tagId
     */
    public function __construct($productId, $tagId)
    {
        $this->productId = Uuid::fromString($productId);
        $this->tagId = Uuid::fromString($tagId);
    }

An example usage inside a Twig template from kommerce-templates:

Chaining calls to get the hex value is painful:

{{ form.hidden('productId', product.id.hex ) }}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions