There are a number of samples included in the SDO PHP source
. This page references all of the samples that we know about and includes new ones when required.
The SDO API Features - The SDO API Sample
http://cvs.php.net/viewvc.cgi/pecl/sdo/scenarios/sdo-api/![]()
Using the SDO_DAS_XML and a contacts record schema this sample shows you how to:
- use the object syntax for setting and getting
- use the array syntax for setting and getting
- access child objects
- iterate over properties
- unset properties
- print a var_dump of a data object
- access properties using XPath
Building Data Objects Dynamically - The Jungle Sample
http://cvs.php.net/viewvc.cgi/pecl/sdo/scenarios/jungle/![]()
Using the SDO_DAS_XML and several schema files this sample shows you how to:
- Populate the type model using multiple XSD files
- Create new SDOs
- Set primitive properties on SDOs
- Reference one SDO from another
- Create an XML Document and add SDOs to it
Using Sequences 1 - The Letter Sample
http://cvs.php.net/viewvc.cgi/pecl/sdo/scenarios/letter/![]()
Using the SDO_DAS_XML and an XML schema to describe a letter to a friend this sample shows you how to:
- Load the type model using and XML schema
- Load and XML document as a SDO
- Get the sequence from the SDO
- Print out each element in the sequence
Using Sequences 2 - The Letter Sample
???
Using the SDO_DAS_XML and an XML schema to describe a letter to a friend this sample shows you how to:
- Load the type model using and XML schema
- Create an XML document
- Create a root element
- Get the sequence
- Add primitve types to the sequence
- Add SDO references to the sequence
- Add text to the sequence
- Write the document to and XML file
To Do
Using the SDO_DAS_Relaational - The Company Sample
http://cvs.php.net/viewvc.cgi/pecl/sdo/DAS/Relational/Scenarios/![]()
The SDO relational DAS includes a sample based on a relational database describing companies, departments and their employess. The are a number of standalone PHP scripts which, when run using the CLI configured PHP, show you how to:
- Create 1 company record (1c-C.php)
- Read 1 company record (1c-R.php)
- Read and update 1 company record (1c-RU.php)
- Read 1 company records and add another one (1c-RA.php)
- Read 1 company record and delete it (1c-RD.php)
- This pattern is repeated for
- 1 company and 1 department (1cd-*.php)
- 1 company, 1 department and 1 employee (1cde-*.php)
- Multiple companies (mc-*.php)
As you will see by looking at this sample there are several variations on the same theme.
Using SDO to build an MVC web application - The Contacts Sample
http://cvs.php.net/viewvc.cgi/pecl/sdo/scenarios/contacts/![]()
A small MVC web application for maintaining a contacts database. The application uses the following layers
- User Interface/View - Browser/HTML
- Controller - PHP scrips to render Welcome and Edit pages and manage a confimration action
- Model - SDOs representing the contacts read from a MySQL database
The application demonstrates:
- Using SDOs to access and update data in a MySQL relational database
- Integrating SDO into application scripts
- Retrieving SDOs an putting their contents on a web page
- Storing SDOs in the session cache between calls
- Updating an SDO based on the contents of a POST
- Updating the MySQL database using SDO
Using SDO to generate an RSS feed from a blog - The RSS Media Sample
http://cvs.php.net/viewvc.cgi/pecl/sdo/scenarios/rss-media/![]()
The bulk of this sample is very similar to the contacts sample in that it provides a web application for adding blog entries and confirming that they have been added. In this simple example the blog entries are stored in an XML file and the RSS feature shows you how to:
- read and xml file on request as an SDO
- copy the data selective into another SDO formatted as an RSS2.0 feed
- return the RSS SDO as XML over HTTP.
This sample is used in the article Streamline working with XML in PHP using Service Data Objects![]()
Using SDO to retrieve data for aggregation onto a page - The Aggregation Sample
???
To Do
Using SDO to support REST based services - The REST sample
???
Shows you how to
- make an SDO interact with multiple DAS
To Do
Using SDO to support Web2.0 applications - The AJAX Sample
???
To Do