Created
August 27, 2019 23:23
-
-
Save thunderer/a8805b0cade36a45490b855997cfac6e to your computer and use it in GitHub Desktop.
Doctrine + SQLite + UUID = ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace Thunder\Entity; | |
/* final */ class Account | |
{ | |
/** @var resource */ | |
private $id; | |
public function __construct(AccountId $id) | |
{ | |
$this->id = (string) $id; // === Uuid::getBytes() | |
} | |
public function getId(): AccountId | |
{ | |
return AccountId::fromBytes($this->id); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<entity name="Thunder\Entity\Account" table="account"> | |
<id name="id" type="binary" length="16" column="id" /> | |
</entity> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment