本文整理汇总了PHP中TagPeer::doSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP TagPeer::doSelect方法的具体用法?PHP TagPeer::doSelect怎么用?PHP TagPeer::doSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagPeer
的用法示例。
在下文中一共展示了TagPeer::doSelect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateTagRelationCache
public static function updateTagRelationCache($manualLock = false)
{
if (!$manualLock) {
self::checkTagRelationCache('lock');
}
try {
$tagRelationsFile = sfConfig::get('sf_root_dir') . "/cache/objcache/tagsRelations.php";
$c = new Criteria();
$allTags = TagPeer::doSelect($c);
$content = "<?php \n";
foreach ($allTags as $singleTag) {
$c = new Criteria();
$c->add(TagrelationPeer::TAG_ID, $singleTag->getId());
$tagRelations = TagrelationPeer::doSelect($c);
if ($tagRelations) {
$elementsArr = "array(";
foreach ($tagRelations as $tagRelation) {
$elementsArr .= $tagRelation->getId() . ",";
}
$content .= "\$_TagRel['" . $singleTag->getTagId() . "'] = " . substr($elementsArr, 0, -1) . ");\n";
}
}
$content .= "\n?>";
if (FileHelper::writeFile($tagRelationsFile, $content)) {
BackendService::loadTagsRelations();
} else {
echo FileHelper::Log("Unable to write tag cache in: " . $tagRelationsFile, UtilsHelper::MSG_ERROR);
}
} catch (Exception $e) {
echo FileHelper::Log("Unable to refresh tag cache: " . $e->getMessage(), UtilsHelper::MSG_ERROR);
}
if (!$manualLock) {
self::checkTagRelationCache('unlock');
}
}
示例2: retrieveTagsFromTTPK
public static function retrieveTagsFromTTPK($id)
{
$c = new Criteria();
$c->add(OppTagHasTtPeer::TESEOTT_ID, $id);
$c->addJoin(OppTagHasTtPeer::TAG_ID, TagPeer::ID);
$c->addAscendingOrderByColumn(TagPeer::TRIPLE_VALUE);
return TagPeer::doSelect($c);
}
示例3: getTags
public function getTags()
{
$c = new Criteria();
$c->add(OppTagHasTtPeer::TESEOTT_ID, $this->getId());
$c->addJoin(OppTagHasTtPeer::TAG_ID, TagPeer::ID);
$c->addAscendingOrderByColumn(TagPeer::TRIPLE_VALUE);
return TagPeer::doSelect($c);
}
示例4: getConfigurationModes
public function getConfigurationModes()
{
$aResult = array();
$aResult['templates'] = AdminManager::getSiteTemplatesForListOutput();
$aResult['tags'] = array();
foreach (TagPeer::doSelect(new Criteria()) as $oTag) {
$aResult['tags'][] = array('name' => $oTag->getName(), 'count' => $oTag->countTagInstances(), 'id' => $oTag->getId());
}
$aResult['types'] = TagInstancePeer::getTaggedModels();
return $aResult;
}
示例5: getNamesForAutocomplete
public static function getNamesForAutocomplete($q)
{
sfLoader::loadHelpers("Url");
$c = new Criteria();
$c->add(TagPeer::NAME, $q . "%", Criteria::LIKE);
$c->setLimit(10);
$names = array();
$tags = TagPeer::doSelect($c);
foreach ($tags as $tag) {
$names[] = array("id" => $tag->getId(), "name" => $tag->getName(), "searchUrl" => url_for("job_listby_tag", $tag));
}
return $names;
}
示例6: searchAction
/**
* @action search
*
* Action to search tags using a string of 3 letters or more.
* @param KalturaTagFilter $tagFilter
* @param KalturaFilterPager $pager
* @return KalturaTagListResponse
*/
public function searchAction(KalturaTagFilter $tagFilter, KalturaFilterPager $pager = null)
{
if (!$tagFilter) {
$tagFilter = new KalturaTagFilter();
}
if (!$pager) {
$pager = new KalturaFilterPager();
}
$tagFilter->validate();
$c = KalturaCriteria::create(TagPeer::OM_CLASS);
$tagCoreFilter = new TagFilter();
$tagFilter->toObject($tagCoreFilter);
$tagCoreFilter->attachToCriteria($c);
$pager->attachToCriteria($c);
$tags = TagPeer::doSelect($c);
$searchResponse = new KalturaTagListResponse();
$searchResponse->objects = KalturaTagArray::fromDbArray($tags);
$searchResponse->totalCount = $c->getRecordsCount();
return $searchResponse;
}
示例7: getIndirectlyMonitoringTags
/**
* returns the Tags (TaggingsJoinTag) that makes the object indirectly monitored
*
* @return Tagging objects (with Tag infoz)
* @author Guglielmo Celata
**/
public function getIndirectlyMonitoringTags($user_id, $criteria = null, $con = null)
{
include_once 'plugins/deppPropelActAsTaggableBehaviorPlugin/lib/model/om/BaseTaggingPeer.php';
if ($criteria === null) {
$criteria = new Criteria();
} elseif ($criteria instanceof Criteria) {
$criteria = clone $criteria;
}
if ($this->collIMTags === null) {
if ($this->isNew()) {
$this->collIMTags = array();
} else {
$criteria->addJoin(TaggingPeer::TAG_ID, TagPeer::ID);
$criteria->addJoin(MonitoringPeer::MONITORABLE_ID, TagPeer::ID);
$criteria->add(TaggingPeer::TAGGABLE_ID, $this->getId());
$criteria->add(MonitoringPeer::USER_ID, $user_id);
$this->collIMTags = TagPeer::doSelect($criteria, $con);
}
} else {
$criteria->addJoin(TaggingPeer::TAG_ID, TagPeer::ID);
$criteria->addJoin(MonitoringPeer::MONITORABLE_ID, TagPeer::ID);
$criteria->add(TaggingPeer::TAGGABLE_ID, $this->getId());
$criteria->add(MonitoringPeer::USER_ID, $user_id);
if (!isset($this->lastIMTagsCriteria) || !$this->lastIMTagsCriteria->equals($criteria)) {
$this->collIMTags = TagPeer::doSelect($criteria, $con);
}
}
$this->lastIMTagsCriteria = $criteria;
return $this->collIMTags;
}
示例8: indexCategoryEntryTagsAction
/**
* @action indexCategoryEntryTags
*
* @param int $categoryId
* @param string $pcToDecrement
* @param string $pcToIncrement
*/
public function indexCategoryEntryTagsAction($categoryId, $pcToDecrement, $pcToIncrement)
{
$pcToDecrementArray = explode(',', $pcToDecrement);
$c = KalturaCriteria::create(TagPeer::OM_CLASS);
$c->add(TagPeer::PARTNER_ID, kCurrentContext::getCurrentPartnerId());
$c->add(TagPeer::PRIVACY_CONTEXT, $pcToDecrementArray, KalturaCriteria::IN);
TagPeer::setUseCriteriaFilter(false);
$tagsToDecrement = TagPeer::doSelect($c);
TagPeer::setUseCriteriaFilter(true);
foreach ($tagsToDecrement as $tag) {
/* @var $tag Tag */
$tag->decrementInstanceCount();
}
$pcToIncrementArray = explode(',', $pcToIncrement);
$tagsToIncrement = array();
$c = new Criteria();
$c->add(categoryEntryPeer::CATEGORY_ID, $categoryId);
$catEntries = categoryEntryPeer::doSelect($c);
foreach ($catEntries as $catEntry) {
/* @var $catEntry categoryEntry */
$entry = entryPeer::retrieveByPK($catEntry->getEntryId());
if ($entry) {
$tagsToIncrement = array_merge($tagsToIncrement, explode(',', $entry->getTags()));
}
}
$tagsToIncrement = array_unique($tagsToIncrement);
kTagFlowManager::addOrIncrementTags(implode(",", $tagsToIncrement), kCurrentContext::getCurrentPartnerId(), "entry", $pcToIncrementArray);
}
示例9: while
while ($entryResults && count($entryResults)) {
foreach ($entryResults as $entry) {
/* @var $entry entry */
$entryTags = trimObjectTags($entry->getTags());
if (!count($entryTags)) {
continue;
}
$c = kTagFlowManager::getTagObjectsByTagStringsCriteria($entryTags, taggedObjectType::ENTRY, $entry->getPartnerId());
$c->applyFilters();
$numTagsFound = $c->getRecordsCount();
if (!$numTagsFound) {
$requiredTags = $entryTags;
} else {
$crit = new Criteria();
$crit->addAnd(TagPeer::ID, $c->getFetchedIds(), KalturaCriteria::IN);
$foundTagObjects = TagPeer::doSelect($crit);
$foundTags = array();
foreach ($foundTagObjects as $foundTag) {
$foundTag->incrementInstanceCount();
$foundTags[] = $foundTag->getTag();
}
$requiredTags = array_diff($entryTags, $foundTags);
}
foreach ($requiredTags as $tagString) {
$tag = new Tag();
$tag->setTag($tagString);
$tag->setPartnerId($entry->getPartnerId());
$tag->setObjectType(taggedObjectType::ENTRY);
$tag->save();
}
}
示例10: checkExistForDelete
/**
* Function which checks the object tags agains DB
* and returns an array of tags ids which need to be deleted.
* @param BaseObject $object
* @return array
*/
protected function checkExistForDelete(BaseObject $object, $tagsToCheck = null)
{
$objectTags = $tagsToCheck ? $this->trimObjectTags($tagsToCheck) : $this->trimObjectTags($object->getTags());
$objectTags = str_replace(self::$specialCharacters, self::$specialCharactersReplacement, $objectTags);
$tagsToKeep = array();
foreach ($objectTags as $objectTag) {
$peer = $object->getPeer();
$c = KalturaCriteria::create(get_class($object));
$c->addAnd(self::PARTNER_ID_FIELD, $object->getPartnerId(), KalturaCriteria::EQUAL);
$c->addAnd($peer::TAGS, $objectTag, KalturaCriteria::LIKE);
$c->addAnd($peer::ID, array($object->getId()), KalturaCriteria::NOT_IN);
$selectResults = $peer->doSelect($c);
foreach ($selectResults as $selectResult) {
$resultTags = $this->trimObjectTags($selectResult->getTags());
if (in_array($objectTag, $resultTags)) {
// if(isset($tagsToKeep[$objectTag]))
// $tagsToKeep[$objectTag]++;
// else
// $tagsToKeep[$objectTag] = 1;
if (!in_array($objectTag, $tagsToKeep)) {
$tagsToKeep[] = $objectTag;
}
}
}
}
KalturaLog::debug("tags to keep: " . print_r($tagsToKeep, true));
if (count($tagsToKeep)) {
//Decrement instance count for the tags that we keep
$c = self::getTagObjectsByTagStringsCriteria($tagsToKeep, $this->getObjectIdByClassName(get_class($object)), $object->getPartnerId());
$tagsToKeepObjects = TagPeer::doSelect($c);
foreach ($tagsToKeepObjects as $tagToKeepObject) {
/* @var $tagToKeepObject Tag */
$tagToKeepObject->decrementInstanceCount();
}
}
//Return the IDs of the rest of the tags for removal.
$tagsToRemove = array_diff($objectTags, $tagsToKeep);
KalturaLog::debug("tags to delete: " . print_r($tagsToRemove, true));
if ($tagsToRemove) {
$c = self::getTagObjectsByTagStringsCriteria($tagsToRemove, $this->getObjectIdByClassName(get_class($object)), $object->getPartnerId());
$c->applyFilters();
$recordsToRemove = $c->getRecordsCount();
return $c->getFetchedIds();
}
return array();
}
示例11: date_default_timezone_set
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', true);
// initialize instance
sfContext::createInstance($configuration);
// set default TIMEZONE
$tz = OptionPeer::retrieveOption('TIMEZONE');
if ($tz) {
date_default_timezone_set($tz);
}
// load URL helper
sfLoader::loadHelpers('Url');
sfConfig::set('sf_relative_url_root', sfConfig::get('app_general_base_url'));
$c = new Criteria();
$expiration_age = OptionPeer::retrieveOption('BUY_DELETE_AFTER') * 24 * 3600;
$c->add(TagPeer::VALID_UNTIL, time() - $expiration_age, Criteria::LESS_EQUAL);
$c->add(TagPeer::STATUS, TagPeer::ST_EXPIRED);
$c->add(TagPeer::IS_PRIMARY, false);
$tags = TagPeer::doSelect($c);
if ($tags) {
foreach ($tags as $tag) {
$interesteds = $tag->getInteresteds();
$jotag = $tag->getJotag();
$tag->deleteFromUser();
Mailer::sendEmail($tag->getUser()->getPrimaryEmail(), 'deletedJotag', array('jotag' => $tag, 'jotag_name' => $jotag), $tag->getUser()->getPreferedLanguage());
if ($interesteds) {
foreach ($interesteds as $interested) {
// notify interested users that this jotag is available again
Mailer::sendEmail($interested->getUser()->getPrimaryEmail(), 'interestNotifyInterested', array('user' => $interested->getUser(), 'jotag' => $interested->getJotag()), $interested->getUser()->getPreferedLanguage());
}
}
}
}
示例12: executeRilevanzaTagExport
/**
* esporta csv con dati storici della rilevanza dei tag, con limite custom
*
* @return void
* @author Guglielmo Celata
*/
public function executeRilevanzaTagExport()
{
sfLoader::loadHelpers(array('Number'));
$this->session = $this->getUser();
$this->forward404Unless($this->session->hasCredential('adhoc'));
$data_inizio = OppLegislaturaPeer::$legislature[OppLegislaturaPeer::getCurrent()]['data_inizio'];
$data_fine = OppTagHistoryCachePeer::fetchLastData();
$date = Util::buildCacheDatesArray($data_inizio, $data_fine);
$limit = $this->getRequestParameter('limit', 50);
$c = new Criteria();
$c->addJoin(TagPeer::ID, OppTagHistoryCachePeer::CHI_ID);
$c->add(OppTagHistoryCachePeer::CHI_TIPO, 'S');
$c->add(OppTagHistoryCachePeer::DATA, $data_fine);
$c->addDescendingOrderByColumn(OppTagHistoryCachePeer::INDICE);
$c->setLimit($limit);
$tags = TagPeer::doSelect($c);
$csv_rows = array();
// costruzione delle serie storiche per ogni politico (da inizio legislatura)
foreach ($tags as $cnt => $tag) {
$tag_id = $tag->getId();
// genero il label
$label = sprintf("%s(%s)", $tag->getTripleValue(), $tag->getTripleNamespace());
// arrotonda l'array dei valori storici a due cifre decimali (max)
$storico = OppTagHistoryCachePeer::getHistory('S', $tag->getId());
// primi campi (dati fissi)
$csv_row = "{$tag_id},\"{$label}\",";
foreach ($date as $cnt => $data) {
if (array_key_exists($data, $storico)) {
$storico[$data] = format_number(round($storico[$data], 2), 'it_IT');
} else {
$storico[$data] = 0;
}
$csv_row .= '"' . $storico[$data] . '"';
if ($cnt < count($date) - 1) {
$csv_row .= ",";
}
}
$csv_rows[] = $csv_row;
}
$this->csv_header = "tag_id,tag(namespace)," . implode(",", $date);
$this->csv_rows = $csv_rows;
$this->setLayout(false);
$this->response->setContentType('text/plain');
}
示例13: getTagsOfDocumentById
public static function getTagsOfDocumentById($documentId)
{
if (!$documentId) {
return null;
}
try {
$c = new Criteria();
$c->add(TagrelationPeer::ID, $documentId);
$tagRelations = TagrelationPeer::doSelect($c);
$tagIDs = array();
foreach ($tagRelations as $tagRel) {
$tagIDs[] = $tagRel->getTagid();
}
if (!empty($tagIDs)) {
$c = new Criteria();
$c->add(TagPeer::ID, $tagIDs, Criteria::IN);
$tags = TagPeer::doSelect($c);
}
return $tags;
} catch (Exception $e) {
throw $e;
}
}
示例14: decrementExistingTagsInstanceCount
/**
* Decrements instance count of tags found on a deleted object
* @param string $tagsToCheck
* @param int $partnerId
* @param string $objectClass
* @param array $privacyContexts
*/
public static function decrementExistingTagsInstanceCount($tagsToCheck, $partnerId, $objectClass, $privacyContexts = null)
{
$objectTags = self::trimObjectTags($tagsToCheck);
if (!count($objectTags)) {
return;
}
$c = self::getTagObjectsByTagStringsCriteria($objectTags, self::getObjectTypeByClassName($objectClass), $partnerId);
if (!is_null($privacyContexts)) {
if (count($privacyContexts)) {
$c->addAnd(TagPeer::PRIVACY_CONTEXT, $privacyContexts, Criteria::IN);
}
} else {
$c->addAnd(TagPeer::PRIVACY_CONTEXT, self::NULL_PC);
}
TagPeer::setUseCriteriaFilter(false);
$tagsToDecrement = TagPeer::doSelect($c);
TagPeer::setUseCriteriaFilter(true);
foreach ($tagsToDecrement as $tag) {
/* @var $tag Tag */
$tag->decrementInstanceCount();
}
}
示例15: Criteria
DbManager::setConfig($dbConf);
DbManager::initialize();
$c = new Criteria();
if ($argc > 1 && is_numeric($argv[1])) {
$c->add(TagPeer::ID, $argv[1], Criteria::GREATER_EQUAL);
}
if ($argc > 2 && is_numeric($argv[2])) {
$c->add(TagPeer::PARTNER_ID, $argv[2], Criteria::EQUAL);
}
$c->addAscendingOrderByColumn(TagPeer::ID);
$c->setLimit(10000);
$con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2);
//$sphinxCon = DbManager::getSphinxConnection();
$tags = TagPeer::doSelect($c, $con);
$sphinx = new kSphinxSearchManager();
while (count($tags)) {
foreach ($tags as $tag) {
/* @var $tag Tag */
KalturaLog::log('tag id ' . $tag->getId() . ' tag string [' . $tag->getTag() . '] crc id[' . $sphinx->getSphinxId($tag) . ']');
try {
$ret = $sphinx->saveToSphinx($tag, true);
} catch (Exception $e) {
KalturaLog::err($e->getMessage());
exit - 1;
}
}
$c->setOffset($c->getOffset() + count($tags));
kMemoryManager::clearMemory();
$tags = TagPeer::doSelect($c, $con);
}
KalturaLog::log('Done');