Пример #1
0
 public function getPath()
 {
     $result = [];
     $query = $this->hasOne(Category::className(), ['id' => 'category_id']);
     $category = $query->one();
     while ($category) {
         $result[] = $category;
         $category = $category->category;
     }
     return $result;
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getParent()
 {
     return $this->hasOne(Category::className(), ['id_categoria' => 'parent_id']);
 }
Пример #3
0
 public function getCategory()
 {
     return $this->hasOne(Category::className(), ["cid" => "cid"]);
 }
Пример #4
0
 public function getCategories()
 {
     return $this->hasOne(Category::className(), ['id' => 'category']);
 }
Пример #5
0
 /**
  * @return CategoryQuery
  */
 public function getCategory()
 {
     return $this->hasOne(Category::className(), ['CategoryID' => 'CategoryID'])->inverseOf('products');
 }
Пример #6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getChildren()
 {
     return $this->hasMany(Category::className(), ['parent_id' => 'id']);
 }
Пример #7
0
 public function getCategories()
 {
     return $this->hasMany(Category::className(), ['category_id' => 'id']);
 }
Пример #8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBookCategory()
 {
     return $this->hasOne(Category::className(), ['id' => 'categoryId']);
 }
Пример #9
0
 public function getCategories()
 {
     return $this->hasMany(Category::className(), ['id' => 'category_id'])->viaTable('post_category', ['post_id' => 'id']);
 }
Пример #10
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCategory()
 {
     return $this->hasOne(Category::className(), ['id' => 'Category_id']);
 }
Пример #11
0
 public function getCategory()
 {
     return $this->hasOne(Category::className(), ['id' => 'category_id'])->via('advert');
 }
Пример #12
0
 /**
  * @return $this
  */
 public function getCategories()
 {
     return $this->hasMany(Category::className(), ['id' => 'category_id'])->viaTable(BooksCategories::tableName(), ['book_id' => 'id']);
 }
Пример #13
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCategoryItem()
 {
     return $this->hasOne(Category::className(), ['ID' => 'category']);
 }