CMS  Version 3.9
Taxonomy Class Reference

Inherits DataItem.

Public Member Functions

 Associations ($constraint="")
 
 Terms ($constraint="")
 
 getTerm ($term)
 
 countTerms ()
 
 getAssociatedItems ($class)
 
 getAssociatedTerms ($item)
 
 getAssociatedTermIds ($item)
 
 getAssociatedTermsByClass ($class)
 

Static Public Member Functions

static fromIdentifier ($identifier)
 

Public Attributes

 $table = "taxonomy"
 
 $primary_key = "taxonomy_id"
 
 $cacheLocal = true
 
 $_termCache = array()
 
 $fields
 
 $relations = array("Terms" => TaxonomyTerm)
 

Detailed Description

Definition at line 39 of file taxonomy.inc.

Member Function Documentation

◆ Associations()

Taxonomy::Associations (   $constraint = "")

Definition at line 64 of file taxonomy.inc.

65  {
66  return $this->getRelatedList(TaxonomyAssociation, "", $constraint);
67  }
$constraint

◆ countTerms()

Taxonomy::countTerms ( )

Definition at line 82 of file taxonomy.inc.

83  {
84  return Query::create(TaxonomyTerm, "WHERE taxonomy_id=:taxonomy")
85  ->bind(":taxonomy", $this->taxonomy_id)
86  ->executeValue("COUNT(1)");
87  }

◆ fromIdentifier()

static Taxonomy::fromIdentifier (   $identifier)
static

Definition at line 57 of file taxonomy.inc.

58  {
59  return Query::create(Taxonomy, "WHERE identifier=:i")
60  ->bind(":i", $identifier)
61  ->executeSingle();
62  }
$identifier
Definition: rss.inc:37

◆ getAssociatedItems()

Taxonomy::getAssociatedItems (   $class)

Definition at line 89 of file taxonomy.inc.

90  {
91  $item = new $class;
92  $pk = $item->getPrimaryKey();
93 
94  return Query::create($class, "WHERE $pk in (SELECT id FROM taxonomy_term_association WHERE taxonomy_id=:t AND class=:c)")
95  ->bind(":t", $this->taxonomy_id,
96  ":c", $class)
97  ->execute();
98  }

◆ getAssociatedTermIds()

Taxonomy::getAssociatedTermIds (   $item)

Definition at line 109 of file taxonomy.inc.

110  {
111  $cl = get_class($item);
112 
113  if (!isset($this->_termCache[$cl]))
114  {
115  $this->_termCache[$cl] = IndexedQuery::create(TaxonomyTermAssociationSummary, "WHERE taxonomy_id=:t and class=:c", "id")
116  ->bind(":t", $this->taxonomy_id,
117  ":c", get_class($item))
118  ->execute();
119  }
120 
121  return $this->_termCache[$cl][$item->get($item->getPrimaryKey())]->term_ids;
122  }

◆ getAssociatedTerms()

Taxonomy::getAssociatedTerms (   $item)

Definition at line 100 of file taxonomy.inc.

101  {
102  return Query::create(TaxonomyTerm, "WHERE term_id IN (SELECT term_id FROM taxonomy_term_association where taxonomy_id=:t and class=:c and id=:i)")
103  ->bind(":t", $this->taxonomy_id,
104  ":c", get_class($item),
105  ":i", $item->get($item->getPrimaryKey()))
106  ->execute();
107  }

◆ getAssociatedTermsByClass()

Taxonomy::getAssociatedTermsByClass (   $class)

Definition at line 124 of file taxonomy.inc.

125  {
126  return Query::create(TaxonomyTerm, "WHERE term_id in (SELECT term_id FROM taxonomy_term_association where taxonomy_id=:id AND class=:cl) ORDER BY sort_order, term")
127  ->bind(":id", $this->taxonomy_id, ":cl", $class)
128  ->execute();
129  }

◆ getTerm()

Taxonomy::getTerm (   $term)

Definition at line 74 of file taxonomy.inc.

75  {
76  return Query::create(TaxonomyTerm, "WHERE taxonomy_id=:taxonomy AND term=:term")
77  ->bind(":taxonomy", $this->taxonomy_id,
78  ":term", $term)
79  ->executeSingle();
80  }
$term
Definition: term_dialog.inc:46

◆ Terms()

Taxonomy::Terms (   $constraint = "")

Definition at line 69 of file taxonomy.inc.

70  {
71  return $this->getRelatedList(TaxonomyTerm, "", $constraint);
72  }

Member Data Documentation

◆ $_termCache

Taxonomy::$_termCache = array()

Definition at line 45 of file taxonomy.inc.

◆ $cacheLocal

Taxonomy::$cacheLocal = true

Definition at line 43 of file taxonomy.inc.

◆ $fields

Taxonomy::$fields
Initial value:
= array("taxonomy_id" => Number,
"identifier" => String,
"taxonomy_name" => String,
"description" => HTML,
"associated_classes" => String,
"published" => Boolean,
"enable_facet_filter" => Boolean)

Definition at line 47 of file taxonomy.inc.

◆ $primary_key

Taxonomy::$primary_key = "taxonomy_id"

Definition at line 42 of file taxonomy.inc.

◆ $relations

Taxonomy::$relations = array("Terms" => TaxonomyTerm)

Definition at line 55 of file taxonomy.inc.

◆ $table

Taxonomy::$table = "taxonomy"

Definition at line 41 of file taxonomy.inc.


The documentation for this class was generated from the following file: