本文整理汇总了PHP中TagPeer::doSelectOne方法的典型用法代码示例。如果您正苦于以下问题:PHP TagPeer::doSelectOne方法的具体用法?PHP TagPeer::doSelectOne怎么用?PHP TagPeer::doSelectOne使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagPeer
的用法示例。
在下文中一共展示了TagPeer::doSelectOne方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recordTags
public static function recordTags($phrase, $model, $obj)
{
$tags = TagTools::splitPhrase($phrase);
foreach ($tags as $settag) {
$tag = new Tag();
if ($model == "etime") {
$modelTag = new EtimeTag();
} else {
$modelTag = new EventTag();
}
$tag->setTag($settag);
$c = new Criteria();
$c->add(TagPeer::NORMALIZED_TAG, $tag->getNormalizedTag());
$tag_exists = TagPeer::doSelectOne($c);
if (!$tag_exists) {
$tag->save();
} else {
$tag = $tag_exists;
}
if ($model == "etime") {
$modelTag->setEtime($obj);
} else {
$modelTag->setEvent($obj);
}
$modelTag->setTag($tag);
$modelTag->save();
}
return true;
}
示例2: executeShow
/**
* Executes index action
*
*/
public function executeShow()
{
$c = new Criteria();
$c->add(TagPeer::NORMALIZED_TAG, $this->getRequestParameter('tag'));
$this->tag = TagPeer::doSelectOne($c);
$this->events = EventPeer::getTaggedEvents($this->getRequestParameter('tag'));
$this->forward404Unless($this->events);
}
示例3: doClean
protected function doClean($value)
{
$criteria = new Criteria();
$criteria->add(TagPeer::JOTAG, $value);
$object = TagPeer::doSelectOne($criteria);
if (is_null($object)) {
throw new sfValidatorError($this, 'invalid', array('value' => $value));
}
return $object->getId();
}
示例4: listTags
private function listTags()
{
$c = new Criteria();
$c->add(TagPeer::NAME, $this->getRequestParameter('name'));
$tag = TagPeer::doSelectOne($c);
$this->getResponse()->setTitle(sprintf('Planeta PHP.pl - Wpisy dla tagu: %s', $tag->getName()));
$c = new Criteria();
$c->addJoin(PostTagPeer::POST_ID, PostPeer::ID, Criteria::LEFT_JOIN);
$c->add(PostTagPeer::TAG_ID, $tag->getId());
return $c;
}
示例5: executeIndex
public function executeIndex()
{
$name = $this->getRequestParameter('tag', '');
$c = new Criteria();
if ($name) {
$c->add(TagPeer::NAME, $name);
$tag = TagPeer::doSelectOne($c);
$this->forward404Unless($tag);
$c->clear();
$c->addJoin(PostTagPeer::POST_ID, PostPeer::ID, Criteria::LEFT_JOIN);
$c->add(PostTagPeer::TAG_ID, $tag->getId());
}
$c->addDescendingOrderByColumn(PostPeer::CREATED_AT);
$c->setLimit(sfConfig::get('app_posts_in_feed', 10));
$c->add(PostPeer::DELETED, false);
$posts = PostPeer::doSelect($c);
$this->feed = $this->createFeed($posts, $name);
ReaderPeer::increment();
}
示例6: getIndexPage
public function getIndexPage()
{
try {
$c = new Criteria();
$c->add(TagPeer::TAG_ID, 'website_page_index');
$tag = TagPeer::doSelectOne($c);
$c = new Criteria();
$c->add(RelationPeer::ID1, $this->getId());
$c->addJoin(RelationPeer::ID2, TagrelationPeer::ID);
$c->add(TagrelationPeer::TAG_ID, $tag->getId());
$relation = RelationPeer::doSelectOne($c);
if ($relation) {
$indexPage = Document::getDocumentInstance($relation->getId2());
return $indexPage;
} else {
return null;
}
} catch (Exception $e) {
throw $e;
}
}
示例7: getTag
/**
* Get the associated Tag object
*
* @param PropelPDO Optional Connection object.
* @return Tag The associated Tag object.
* @throws PropelException
*/
public function getTag(PropelPDO $con = null)
{
if ($this->aTag === null && $this->tag_id !== null) {
$c = new Criteria(TagPeer::DATABASE_NAME);
$c->add(TagPeer::ID, $this->tag_id);
$this->aTag = TagPeer::doSelectOne($c, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection
in the referenced object.
$this->aTag->addTaggings($this);
*/
}
return $this->aTag;
}
示例8: getNamesFromValues
function getNamesFromValues($values)
{
$tagvalues = explode(",", $values);
$tagnames = array();
foreach ($tagvalues as $tagvalue) {
$c = new Criteria();
$c->add(TagPeer::TRIPLE_VALUE, $tagvalue);
$tag = TagPeer::doSelectOne($c);
if ($tag instanceof Tag) {
$tagnames[] = $tag->getName();
} else {
$tagnames[] = deppPropelActAsTaggableToolkit::transformTagStringIntoTripleString($tagvalue, 'user', 'tag');
}
}
return implode(",", $tagnames);
}
示例9: define
define('SF_ROOT_DIR', realpath(dirname(__FILE__) . '/../..'));
define('SF_APP', 'fe');
define('SF_ENVIRONMENT', 'dev');
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();
include "../parser/lista_tags_macrotags.php";
if (count($tags) == count($macrotags)) {
//Tagga OGGETTI TAGGATI con $tag anche con $macrotag
foreach ($tags as $k => $tag) {
$c = new Criteria();
$c->add(TagPeer::ID, $tag);
$result = TagPeer::doSelectOne($c);
if ($result) {
for ($x = 0; $x <= 1; $x++) {
$c = new Criteria();
$c->add(TagPeer::ID, $macrotags[$k][$x]);
$mt = TagPeer::doSelectOne($c);
if ($mt) {
echo $result->getId() . "\t" . $result->getTripleValue() . "\t" . $mt->getId() . "\t" . $mt->getTripleValue() . "\n";
} elseif ($macrotags[$k][$x] != 0) {
echo "!!!! " . $result->getId() . "\t" . $result->getTripleValue() . " \t errore non esiste macrotag=\t" . $macrotags[$k][$x] . "\n";
}
}
} else {
echo "!!!! \terrore non esiste TAG=\t" . $tag . "\t\n";
}
}
} else {
echo "!!!!! Gli array hanno un numero di elementi diversi!";
}
示例10: retrieveByTagname
/**
* Retrives a tag by his name.
*
* @param String $tagname
* @return Tag
*/
public static function retrieveByTagname($tagname)
{
$c = new Criteria();
$c->add(TagPeer::NAME, $tagname);
return TagPeer::doSelectOne($c);
}
示例11: getDocumentsByTag
public static function getDocumentsByTag($tagId)
{
try {
if (BackendService::loadTagsRelations()) {
if (array_key_exists('tagsRelations', $_SESSION) && array_key_exists($tagId, $_SESSION['tagsRelations'])) {
$docs = $_SESSION['tagsRelations'][$tagId];
}
foreach ($docs as $docId) {
$document = self::getDocumentInstance($docId);
if ($document) {
$documents[] = $document;
}
}
} else {
$c = new Criteria();
$c->add(TagPeer::TAG_ID, $tagId);
$tag = TagPeer::doSelectOne($c);
if (!$tag) {
return null;
}
$c = new Criteria();
$c->add(TagrelationPeer::TAG_ID, $tag->getId());
$tagRelations = TagrelationPeer::doSelect($c);
$documents = array();
foreach ($tagRelations as $tagRelation) {
$document = self::getDocumentInstance($tagRelation->getId());
if ($document) {
$documents[] = $document;
}
}
}
return $documents;
} catch (Exception $e) {
return null;
}
}
示例12: getIdFromTagValue
/**
* extracts an id from a value
*
* @param string $value (triple value)
* @return id
* @author Guglielmo Celata
*/
public static function getIdFromTagValue($tag_value)
{
$c = new Criteria();
$c->add(TagPeer::TRIPLE_VALUE, $tag_value);
$tag = TagPeer::doSelectOne($c);
if ($tag instanceof Tag) {
return $tag->getId();
} else {
return null;
}
}