Difference between revisions of "OpenStack-SDK-PHP/Design/Service-Models"
(Created page with "To achieve dynamic properties with models, we can use two methods: # Have all models implement \ArrayAccess, allowing them to be treated as arrays. Users are already comforta...") |
(No difference)
|
Revision as of 10:39, 8 April 2014
To achieve dynamic properties with models, we can use two methods:
- Have all models implement \ArrayAccess, allowing them to be treated as arrays. Users are already comfortable with the dynamic nature of arrays.
- Use magic methods. This is more unpredictable and often asks users to make a leap of faith (guessing methods) because the API isn't defined
My personal opinion is to use \ArrayAccess, since it's a standard and well-supported approach.