While designing a class I assumed that having an $id property will make that class Entity rather than a value object.
I also have an toArray() method which converts the object to associative array and that response is send to post and patch api’s
Now I have the following questions:
POST works, since I’m not sending the id in the body. But for patch is it fine if I set the property dynamically after object creation? For Ex: $redCircle = new Circle(“red”); $redCircle->id =10; $api->patch($redCircle->toArray());
Aucun commentaire:
Enregistrer un commentaire