Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using UuidInterface everywhere is painful #89

Open
pdt256 opened this issue Jan 1, 2017 · 1 comment
Open

Using UuidInterface everywhere is painful #89

pdt256 opened this issue Jan 1, 2017 · 1 comment

Comments

@pdt256
Copy link
Member

pdt256 commented Jan 1, 2017

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 ) }}
@pdt256
Copy link
Member Author

pdt256 commented Jan 1, 2017

I suggest we use uuid's as strings throughout kommerce-core, kommerce-templates, and kommerce-laravel projects. The repository layer would need to do the conversion from string to bytes. This would be a very large refactor.

@pdt256 pdt256 added this to the Version 0.7.0 milestone Jan 1, 2017
@pdt256 pdt256 removed this from the Version 0.7.0 milestone Jan 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant