You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{"error":{"messages":["Encountered object of type \u0022Api\Admin\Enum\AdminStatusEnum\u0022 when serializing Mezzio\Hal\HalResource instance; unable to serialize"]}}
The text was updated successfully, but these errors were encountered:
Could you provide more details on how you encountered this issue?
Did it happen on calling a specific endpoint?
If not, please send a code snippet on how to reproduce the issue.
The latest version of dotkernel api implement the Doctrine EnumType columns in the Admin and User. Mezzio\Hal\HalResource doesn't know how to serialize the AdminStatusEnumType.
When you composer serve and hit the endpoint at http://localhost:8080/admin to list all admin. You encounter the following error message at the brower:
| {"error":{"messages":["Encountered object of type \u0022Api\Admin\Enum\AdminStatusEnum\u0022 when serializing Mezzio\Hal\HalResource instance; unable to serialize"]}}
Did you modify anything in your copy of Dotkernel API before running it and encountering this error?
Does this behaviour persist with other endpoints as well? i.e.: /admin/role, /users, /admin/my-account
Off-topic:
We strongly recommend using virtualhosts for running your applications.
They provide a low-effort solution for running applications without the need for manually starting them every time.
See our documentation on setting up WSL2 and creating virtualhosts in a WSL2 Linux distro if you're on WIndows.
If you are on a different operating system, you can find tutorials on the internet.
On-topic:
I just tested step-by-step using your method and could not reproduce the issue you are describing.
make sure that the custom enum types are registered in your config/autoload/doctrine.global.php file
navigate to the root of your project and run the tests by executing the below command:
(If present in the log directory, delete the current day's log file error-log-2024-11-XX.log else the tests might fail due to file permission issues)
composer test
If the tests succeed, it means that the serialization works.
Conclusion
Let us know your server specifications so we can narrow down possible causes of the issue you're describing:
operating system
PHP version
database type and client/server version
your Dotkernel API version (see the most recent release in your CHANGELOG.md file)
{"error":{"messages":["Encountered object of type \u0022Api\Admin\Enum\AdminStatusEnum\u0022 when serializing Mezzio\Hal\HalResource instance; unable to serialize"]}}
The text was updated successfully, but these errors were encountered: