Пример #1
0
$lnk4->setUrl('http://techportal.ibuildings.com/');
$lnk4->addTag('techportal');
$lnk4->addTag('ibuildings');
$lnk4->addTag('com');
$linkPeer->insert($lnk1);
$linkPeer->insert($lnk2);
$linkPeer->insert($lnk3);
$linkPeer->insert($lnk4);
// Print the entire database
echo "> new entire database :\n";
foreach ($linkPeer->fetchAll() as $link) {
    echo "{$link}\n";
}
echo "\n----\n";
// Print the techportal link
echo "> retrieve the techportal link:\n";
echo $linkPeer->fetchByUrl('http://techportal.ibuildings.com/');
echo "\n----\n";
// Print all com tagged links
echo "> retrieve all 'com' tagged links:\n";
foreach ($linkPeer->fetchByTag('com') as $link) {
    echo "{$link}\n";
}
echo "----\n";
// Update the techportal link and print
$lnk4->addTag('mongo');
$linkPeer->update($lnk4);
// Print the techportal link
echo "> retrieve the updated techportal link:\n";
echo $linkPeer->fetchByUrl('http://techportal.ibuildings.com/');
echo "\n----\n";