當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TagPeer::getRelatedTags方法代碼示例

本文整理匯總了PHP中TagPeer::getRelatedTags方法的典型用法代碼示例。如果您正苦於以下問題:PHP TagPeer::getRelatedTags方法的具體用法?PHP TagPeer::getRelatedTags怎麽用?PHP TagPeer::getRelatedTags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TagPeer的用法示例。


在下文中一共展示了TagPeer::getRelatedTags方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getRelated

 public function getRelated($options = array())
 {
     return TagPeer::getRelatedTags($this->getName());
 }
開發者ID:adatta02,項目名稱:comp190-code,代碼行數:4,代碼來源:Tag.php

示例2: array

$t->ok(array_keys($tags) == array('tag1', 'tag3', 'tag7'), 'most popular tags can be retrieved with getPopulars().');
$t->ok($tags['tag3'] >= $tags['tag1'], 'getPopulars() preserves tag importance.');
// getRelatedTags() test
$tags = TagPeer::getRelatedTags('tag8');
$t->ok(array_keys($tags) == array('tag2', 'tag3', 'tag7'), 'related tags can be retrieved with getRelatedTags().');
$c = new Criteria();
$tags = TagPeer::getRelatedTags('tag2', array('limit' => 1));
$t->ok(array_keys($tags) == array('tag3'), 'when a limit is set, only most popular related tags are returned by getRelatedTags().');
// getRelatedTags() test
$tags = TagPeer::getRelatedTags('tag7');
$t->ok(array_keys($tags) == array('tag1', 'tag2', 'tag3', 'tag4', 'tag8'), 'getRelatedTags() aggregates tags from different objects.');
// getRelatedTags() test
$tags = TagPeer::getRelatedTags(array('tag2', 'tag7'));
$t->ok(array_keys($tags) == array('tag3', 'tag8'), 'getRelatedTags() can retrieve tags related to an array of tags.');
// getRelatedTags() test
$tags = TagPeer::getRelatedTags('tag2,tag7');
$t->ok(array_keys($tags) == array('tag3', 'tag8'), 'getRelatedTags() also accepts a coma-separated string.');
// getTaggedWith() tests
$object_2_1 = _create_object_2();
$object_2_1->addTag('tag1,tag3,tag7');
$object_2_1->save();
$object_2_2 = _create_object_2();
$object_2_2->addTag('tag2,tag7');
$object_2_2->save();
$tagged_with_tag4 = TagPeer::getTaggedWith('tag4');
$t->ok(count($tagged_with_tag4) == 2, 'getTaggedWith() returns objects tagged with one specific tag.');
$tagged_with_tag7 = TagPeer::getTaggedWith('tag7');
$t->ok(count($tagged_with_tag7) == 5, 'getTaggedWith() can return several object types.');
$tagged_with_tag17 = TagPeer::getTaggedWith(array('tag1', 'tag7'));
$t->ok(count($tagged_with_tag17) == 3, 'getTaggedWith() returns objects tagged with several specific tags.');
$tagged_with_tag127 = TagPeer::getTaggedWith('tag1, tag2, tag7', array('nb_common_tags' => 2));
開發者ID:valerio-bozzolan,項目名稱:openparlamento,代碼行數:31,代碼來源:deppPropelActAsTaggableBehaviorTest.php

示例3: executeArgomenticorrelati

 public function executeArgomenticorrelati()
 {
     $this->related_tags = TagPeer::getRelatedTags($this->tag->getName(), array('limit' => 20, 'model' => 'OppAtto'));
 }
開發者ID:valerio-bozzolan,項目名稱:openparlamento,代碼行數:4,代碼來源:components.class.php


注:本文中的TagPeer::getRelatedTags方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。