Jump to: navigation, search

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...")
 
Line 1: Line 1:
 +
''Jamie's comments (Tuesday 8th):''
 +
 
To achieve dynamic properties with models, we can use two methods:
 
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.
 
# 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
  
# 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.
 
My personal opinion is to use \ArrayAccess, since it's a standard and well-supported approach.

Revision as of 10:40, 8 April 2014

Jamie's comments (Tuesday 8th):

To achieve dynamic properties with models, we can use two methods:

  1. Have all models implement \ArrayAccess, allowing them to be treated as arrays. Users are already comfortable with the dynamic nature of arrays.
  2. 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.