The followings are the available columns in table 'product_to_category':
Inheritance: extends CActiveRecord
Example #1
0
 public function clearAllCategoriesRelations()
 {
     ProductToCategory::model()->deleteAllByAttributes(array('product_id' => $this->product_id));
 }
Example #2
0
 public function afterDelete()
 {
     // delete children
     $children = Category::model()->findAll("parent_id={$this->cacheId}");
     foreach ($children as $child) {
         $child->delete();
     }
     // delete dependencies
     CategoryPath::model()->deleteAll("category_id={$this->cacheId}");
     CategoryDescription::model()->deleteAll("category_id={$this->cacheId}");
     CategoryFilter::model()->deleteAll("category_id={$this->cacheId}");
     CategoryToStore::model()->deleteAll("category_id={$this->cacheId}");
     CategoryToLayout::model()->deleteAll("category_id={$this->cacheId}");
     ProductToCategory::model()->deleteAll("category_id={$this->cacheId}");
     UrlAlias::model()->deleteAll("query='category_id={$this->cacheId}'");
     parent::afterDelete();
 }
Example #3
0
 public static function haveProducts($id)
 {
     return ProductToCategory::where('category_id', $id)->find_one() !== false;
 }