- 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: Get{Child}List()
The GetChildrenList() Relations method allows you to retrieve an array of child objects associated with the parent object. The list of child objects return consists of children that have already been saved to the database. If the parent has children that have been added (via AddChild() ) but not yet committed to the database (via Save() ), the non-committed children are not returned by GetChildrenList(). GetChildrenList() returns an array of child objects.
PHP:
//To retrieve a list of books associated with an author, simply do the following:
$author = new Author( ) ; //create a parent object
$author -> name = ‘Michael Critchton’ ;
$author -> Save( ) ;
$book = new Book( ) ; //create a child object
$book -> title = " Jurassic Park" ;
$book -> SetAuthor ($author) ; //associate child object to parent and save
$book -> Save( ) ;
$book = new Book( ) ; //create a second child object
$book -> title = " State of Fear" ;
$author -> AddBook($book) ; //associate 2nd child to parent object
$book -> Save();
$bookList = $author -> GetBookList ( ) ; //returns a list of children
for each($bookList as $book)
{
echo $book -> title;
}
$author = new Author( ) ; //create a parent object
$author -> name = ‘Michael Critchton’ ;
$author -> Save( ) ;
$book = new Book( ) ; //create a child object
$book -> title = " Jurassic Park" ;
$book -> SetAuthor ($author) ; //associate child object to parent and save
$book -> Save( ) ;
$book = new Book( ) ; //create a second child object
$book -> title = " State of Fear" ;
$author -> AddBook($book) ; //associate 2nd child to parent object
$book -> Save();
$bookList = $author -> GetBookList ( ) ; //returns a list of children
for each($bookList as $book)
{
echo $book -> title;
}
The code sample above will print
Jurassic Park
State of Fear



The method syntax Get{Child}List varies depending on the name of the Child object. If your Child object is called "Author" the method name will be GetBookList.