Description
I've got a trait to generate a public ID (Stripe-style with prefix, e.g. ws_9mJrX3hPMFMRPx3X):
trait HasPublicId
{
#[IsBindingValue]
public PublicId $publicId {
get {
$this->publicId ??= PublicId::create(self::idPrefix());
return $this->publicId;
}
set(string|PublicId $value) {
$this->publicId = new PublicId($value);
}
}
/**
* @return non-empty-lowercase-string
*/
public static function idPrefix(): string
{
$classReflector = new ClassReflector(self::class);
$objectIdPrefix = $classReflector->getAttribute(PublicIdPrefix::class)
?? throw new MissingAttributeException(PublicIdPrefix::class);
return $objectIdPrefix->prefix;
}
}
Currently IsDatabaseModel / ModelInspector ignores it. Any way to add an option for an opt-in via an attribute?
Description
I've got a trait to generate a public ID (Stripe-style with prefix, e.g.
ws_9mJrX3hPMFMRPx3X):Currently
IsDatabaseModel/ModelInspectorignores it. Any way to add an option for an opt-in via an attribute?