Skip to content

Instantly share code, notes, and snippets.

@sergigp
Created May 15, 2015 09:23
Show Gist options
  • Save sergigp/dbb389deb3289840e644 to your computer and use it in GitHub Desktop.
Save sergigp/dbb389deb3289840e644 to your computer and use it in GitHub Desktop.
final class User extends AggregateRoot
{
private $id;
protected function getRules()
{
return [
'id' => [UserId::class],
];
}
}
final class UserStub
{
public static function create(UserId $userId)
{
return new User(['id' => $userId]);
}
public static function random()
{
return static::create(UserIdStub::random());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment