I need help, please. Maybe it’s a bug or a feature request.
I’m getting the following error when parsing an enum to xml document:
“App\Model\Enum\AutoAppointmentBooking could not be converted to string”
It occures in this line (CakePHP 5.1.1):
CORE/src/Utility/Xml.php at line 344
$child->appendChild(new DOMText((string)$value));
Here is the enum:
enum AutoAppointmentBooking: int
{
case OFF = 0;
case ON = 1;
case ON_OUTSIDE_BUSINESS_HOURS = 2;
}
When I try to add __toString() method to the enum, I get a fatal error:
“Fatal error: Enum App\Model\Enum\AutoAppointmentBooking cannot include magic method __toString”
How can I solve that?