-
Notifications
You must be signed in to change notification settings - Fork 249
Notes for SDK Developers
gecampbell edited this page Feb 12, 2013
·
6 revisions
- Most objects are a subclass of
PersistentObject
. Before you add new code to handle a specific object, think about whether or not that code can be made reusable for other objects. If so, it should probably go in thePersistentObject
class. - Most objects are associated with a Service. The Service can be considered
the object's parent.
PersistentObject
provides two methods:Service()
andParent()
. These are synonyms by default. In some cases, however, the parent of an object is not a service, but another object type. For example, the parent ofVolumeAttachment
is aServer
, not a service. In these cases, the__construct()
method of the child class should save the parent object and override theParent()
method to return it as opposed to theService()
. To continue with theVolumeAttachment
example, using theService()
to construct a URL results in an incorrect Url. - If you submit a code change, you should also submit unit tests. Unit tests
use the PHPUnit test framework and are stored under the
tests/
directory.