- Introduction to POG
- Setting up PHP, MySQL etc.
- Designing your objects
- Generating your code
- Description of the generated code
- Edit configuration file
- The Setup Process
- Using the code: Save()
- Using the code: Get()
- Using the code: SaveNew()
- Using the code: GetList()
- Using the code: Delete()
- Using the code: DeleteList()
- Advanced: object relations
- Advanced: Set{Parent}()
- Advanced: Get{Parent}()
- Advanced: Add{Child}()
- Advanced: Get{Child}List()
- Advanced: Save(deep)
- Advanced: Delete(deep)
- Advanced: Add{Sibling}()
- Advanced: Set{Child}List()
- Advanced: Set{Sibling}List()
- Advanced: Get{Sibling}List()
- Advanced: DeleteList(deep)
- Customizing POG-generated code
- Customizing: Extending POG Objects
- Customizing: Plugins
- Examples
- Examples: User registration system
- Examples: User authentication
- Examples: Survey form
- Examples: Using POG with AJAX
- PDO: Introduction
- PDO: SQLite example
- PDO: Firebird example
- PDO: PostgreSQL example
- PDO: MySQL example
- PDO: ODBC example
- Troubleshooting
- Troubleshooting: Data appears encoded
- Troubleshooting: Can't regenerate object
- Troubleshooting: Can't seem to Save()
- Troubleshooting: Can't get object / object attributes from database
- Troubleshooting: Can't open zip file on Mac
- Troubleshooting: Setup screen is blank
- Videos
- Appendix: Creating table(s) manually
- Appendix: Regenerating objects
- Appendix: Generating objects using SOAP
- Case Study: Gravity GTD
- Case Study: Web Form Factory
Back to the Code Generator
The POG Weblog and RSS feed.
The POG Google group
Advanced: Add{Sibling}()
The Add {Sibling} Relations method allows you to associate a sibling object to another sibling object. The 2nd sibling object is added to a private sibling Array inside the 1st sibling object. The sibling object is not saved to the database until Save() is called.
CODE EXAMPLES:
Let’s consider the example of Magazines and Subscribers. A Magazine has many subscribers and each subscriber can subscribe to 1 or more magazines. To prevent circular dependencies, A sibling cannot add each other successively within the same code block.
For example:
$silbing1 -> AddSibling2($sibling2)
$sibling2 -> AddSibling1($sibling1) (NOT ALLOWED IF sibling 1 already references sibling 2)
PHP:
//To Add a book object to an Author object, simply do the following:
$magazine= new Magazine( ) ; //create a magazine object
$magazine-> title = "Popular Mechanics" ;
$subscriber = new Subscriber( ) ; //create a subscriber object
$subscriber-> name = 'John Smith';
$subscriber-> AddMagazine($magazine) ; //associate magazine to subscriber
$magazine= new Magazine( ) ; //create a magazine object
$magazine-> title = "Popular Mechanics" ;
$subscriber = new Subscriber( ) ; //create a subscriber object
$subscriber-> name = 'John Smith';
$subscriber-> AddMagazine($magazine) ; //associate magazine to subscriber



The method syntax Add{Sibling} varies depending on the name of the Sibling object. If your sibling object is called "Author" the method name will be AddAuthor.