Example #1
0
dbm_debug('info', 'Loading a Review by itself, Review 1');
$review = new Review(1);
$review->dumpview(true);
dbm_debug('info', 'Determining which review this book is for. . .');
$books = $review->getBackLinks('Book');
foreach ($books as $book) {
    $info = $book->attribs();
    dbm_debug('info', "written about {$info['title']} by {$info['author']}.");
}
dbm_debug('heading', 'Beginning testing for relational linking.');
$collection = new Collection(1);
$mhi = new Book(1);
$aotr = new Book(2);
$tram = new Book(3);
dbm_debug('info', 'Loaded a collection and three books:');
$collection->dumpview(true);
$mhi->dumpview(true);
$aotr->dumpview(true);
$tram->dumpview(true);
dbm_debug('info', 'Creating a relational link "Sci-Fi" from collection 1 to book 1');
$collection->link($mhi, "Sci-Fi");
dbm_debug('info', 'Creating a relational link "guns" from collection 1 to book 1');
$collection->link($mhi, "guns");
dbm_debug('info', 'Creating a relational link "guns" from collection 1 to book 2');
$collection->link($aotr, "guns");
dbm_debug('info', 'Creating a blank link from collection 1 to book 3');
$collection->link($tram);
dbm_debug('info', 'Attempting to find all books labeled "Sci-Fi" (should just be Monster Hunter International)');
$books = $collection->getLinks('Book', 'Sci-Fi');
foreach ($books as $book) {
    $book->dumpview(true);