CDbException

Relation "wp_term_taxonomy" is not defined in active record class "TermRelationships".

/home/nick22/public_html/yii/framework/db/ar/CActiveFinder.php(215)

203             // named scope
204             $scopes=array();
205             if(($pos=strpos($with,':'))!==false)
206             {
207                 $scopes=explode(':',substr($with,$pos+1));
208                 $with=substr($with,0,$pos);
209             }
210 
211             if(isset($parent->children[$with]) && $parent->children[$with]->master===null)
212                 return $parent->children[$with];
213 
214             if(($relation=$parent->model->getActiveRelation($with))===null)
215                 throw new CDbException(Yii::t('yii','Relation "{name}" is not defined in active record class "{class}".',
216                     array('{class}'=>get_class($parent->model), '{name}'=>$with)));
217 
218             $relation=clone $relation;
219             $model=CActiveRecord::model($relation->className);
220             if($relation instanceof CActiveRelation)
221             {
222                 $oldAlias=$model->getTableAlias(false,false);
223                 if(isset($options['alias']))
224                     $model->setTableAlias($options['alias']);
225                 else if($relation->alias===null)
226                     $model->setTableAlias($relation->name);
227                 else

Stack Trace

#4
+
 /home/nick22/public_html/protected/modules/blog/models/TermRelationships.php(124): CActiveRecord->findAll(CDbCriteria)
119            $crit->select = array('object_id');
120                 $crit->join = 'left JOIN wp_term_taxonomy ON t.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
121                                 left JOIN wp_terms ON wp_terms.term_id = wp_term_taxonomy.term_id';
122                 $crit->condition = 'wp_term_taxonomy.taxonomy = "category" and wp_terms.slug = :slug';
123                 $crit->params = array(':slug' => "$slug");
124                  $posts = $this->findAll($crit);
125             return $posts;
126                         
127     }
128     
129 }
#5
+
 /home/nick22/public_html/protected/modules/blog/views/post/category.php(74): TermRelationships->getPostsByCategorySlug("website-design")
69 $crit->condition = "wp_term_taxonomy.taxonomy = 'category' and wp_terms.slug=:cat";
70 $crit->params = array(':cat' => "$cat");
71 //    $models = Terms::model()->findAll($criteria);
72 */
73 $tagPosts = array();
74 $models = TermRelationships::model()->getPostsByCategorySlug($tag);
75 foreach ($models as $ml) {
76 //  foreach ($model as $k => $v) '<br />' . $k . " : " . $v . "<br />";
77 
78 //echo "<br />" . $ml->object_id . "<br />";
79 $tagPosts[] = Posts::model()->findByPk($ml->object_id);
#10
+
 /home/nick22/public_html/protected/modules/blog/controllers/PostController.php(35): CController->render("category")
30     public function actionCategory() {
31         
32         if ($params = $this->getActionParams()) {
33             if (isset($params['cat'])) {
34                 $category = $params['cat'];
35                 $this->render('category');
36             }
37         }
38         else {
39             $this->render('index');
40         }
2024-03-28 19:45:47 Apache Yii Framework/1.1.9