-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Description
What problem does your feature request address?
It would be convenient to be able to write code like :
$chargebeeClient->subscription()->all(['status' => ['is' => Status::ACTIVE]])
$chargebeeClient->subscription()->all(['status' => ['is' => $subscription->status])Currently this produces "Object of class Chargebee\Resources\Subscription\Enums\Status could not be converted to string.",
and we have to explicitly convert to a string :
$chargebeeClient->subscription()->all(['status' => ['is' => Status::ACTIVE->value]])
$chargebeeClient->subscription()->all(['status' => ['is' => $subscription->status->value])Yet it is very easy to convert a string Enum to a string ;-)
Describe the desired solution
In Util::asString(),
add something like :
if ($value instanceof \Enum && (new \ReflectionEnum($value))->getBackingType()?->getName() === 'string') {
return $value->value;
}Metadata
Metadata
Assignees
Labels
No labels