本文整理汇总了PHP中TagPeer::retrieveByPk方法的典型用法代码示例。如果您正苦于以下问题:PHP TagPeer::retrieveByPk方法的具体用法?PHP TagPeer::retrieveByPk怎么用?PHP TagPeer::retrieveByPk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagPeer
的用法示例。
在下文中一共展示了TagPeer::retrieveByPk方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: define
<?php
/*
controlla le news che fanno riferimento a tag che non esistono e le cancella
*/
define('SF_ROOT_DIR', realpath(dirname(__FILE__) . '/../..'));
define('SF_APP', 'fe');
define('SF_ENVIRONMENT', 'prod');
define('SF_DEBUG', false);
require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
sfContext::getInstance();
$c = new Criteria();
$c->add(NewsPeer::RELATED_MONITORABLE_MODEL, 'Tag');
$news = NewsPeer::doSelect($c);
foreach ($news as $n) {
$tag = TagPeer::retrieveByPk($n->getRelatedMonitorableId());
if (!$tag) {
echo "tag id=" . $n->getRelatedMonitorableId() . ", trovato nelle news id=" . $n->getId() . " non esiste. Cancello la news\n";
$n->delete();
}
}
示例2: foreach
<?php
foreach ($tags as $tag) {
?>
<?php
echo TagPeer::retrieveByPk($tag[0])->getTripleValue() . " - " . $tag[1] . "<br/>";
}
?>
示例3: foreach
echo "Monitoraggio cambiato: " . $old . " con " . $tag_new[$k] . " per utente " . $rs->getUserId() . "\n";
$number_monitor_ok = $number_monitor_ok + 1;
} else {
$rs->delete();
$number_monitor_no = $number_monitor_no + 1;
echo "!!!! DOPPIONE" . $old . " con " . $tag_new[$k] . " per utente " . $rs->getUserId() . "\n";
}
}
}
}
//Cancella tutte le news legate ai vecchi tags
foreach ($tag_old as $k => $old) {
$news = NewsPeer::getNewsRelatedToMonitorableModelAndId('Tag', $old);
foreach ($news as $new) {
$new->delete();
echo "cancello news \n";
}
}
//Cancella i tag vecchi
foreach ($tag_old as $k => $old) {
$tag = TagPeer::retrieveByPk($old);
if ($tag) {
$tag->delete();
echo "cancello tag \n";
}
}
} else {
echo "!!!!! Gli array hanno un numero di elementi diversi!";
}
echo "\n============\n" . $number_tagging_ok . " - " . $number_tagging_no;
echo "\n============\n" . $number_monitor_ok . " - " . $number_monitor_no;
示例4: count
$c->add(TaggingPeer::TAG_ID, $tag);
if ($argv[1] == 1) {
$c->add(TaggingPeer::TAGGABLE_MODEL, 'OppAtto');
}
$results = TaggingPeer::doSelect($c);
$number = $number + count($results);
foreach ($results as $rs) {
for ($x = 0; $x <= 1; $x++) {
if ($macrotags[$k][$x] != 0) {
$c = new Criteria();
$c->add(TaggingPeer::TAG_ID, $macrotags[$k][$x]);
$c->add(TaggingPeer::TAGGABLE_ID, $rs->getTaggableId());
$c->add(TaggingPeer::TAGGABLE_MODEL, $rs->getTaggableModel());
$r = TaggingPeer::doSelectOne($c);
if (!$r) {
$t = TagPeer::retrieveByPk($macrotags[$k][$x]);
if ($t) {
$insert = new Tagging();
$insert->setTagId($macrotags[$k][$x]);
$insert->setTaggableId($rs->getTaggableId());
$insert->setTaggableModel($rs->getTaggableModel());
$insert->save();
echo "++++++++++++++++++++++++++++++++++++++++++ aggiunto " . $macrotags[$k][$x] . " - " . $t->getTripleValue() . " in " . $rs->getTaggableId() . "\n";
$number_tagging_ok = $number_tagging_ok + 1;
} else {
echo "!!!! non esiste Macrotags con id=" . $macrotags[$k][$x] . "\n";
}
} else {
echo "NON aggiungo, già esiste! \n";
$number_tagging_no = $number_tagging_no + 1;
}