当前位置: 首页>>代码示例>>PHP>>正文


PHP TagPeer::retrieveByPk方法代码示例

本文整理汇总了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();
    }
}
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:21,代码来源:controlla_news_con_tag_che_non_esistono.php

示例2: foreach

<?php

foreach ($tags as $tag) {
    ?>
  <?php 
    echo TagPeer::retrieveByPk($tag[0])->getTripleValue() . " - " . $tag[1] . "<br/>";
}
?>
  
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:8,代码来源:_ddl2argomenti.php

示例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;
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:31,代码来源:sostituisci_tag_con_altro_tag.php

示例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;
             }
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:31,代码来源:associa_a_macrotag.php


注:本文中的TagPeer::retrieveByPk方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。