Example #1
0
 public function getCategory()
 {
     return $this->hasOne(Category::className(), ['id' => 'category_id']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCategories()
 {
     return $this->hasMany(Category::className(), ['category_id' => 'category_id'])->viaTable('film_category', ['film_id' => 'film_id']);
 }
Example #3
0
</h2>

    <!--NAME-->
    <?php 
echo $form->field($products_translation, 'title', ['inputOptions' => ['class' => 'form-control']])->label(\Yii::t('shop', 'Name'));
?>

    <div class="row">
        <!--CATEGORY-->
        <div class="col-md-6">
            <b><?php 
echo \Yii::t('shop', 'Category');
?>
</b>
            <?php 
echo InputTree::widget(['className' => Category::className(), 'form' => $form, 'model' => $product, 'attribute' => 'category_id', 'languageId' => $selectedLanguage->id]);
?>
        </div>
        <div class="col-md-6">
            <div>
                <!--ARTICULUS-->
                <?php 
echo $form->field($product, 'articulus', ['inputOptions' => ['class' => 'form-control']])->label(\Yii::t('shop', 'Articulus'));
?>
            </div>
            <div>
                <!--STANDART PRICE-->
                <?php 
echo $form->field($product, 'price', ['inputOptions' => ['class' => 'form-control']])->textInput(['type' => 'number', 'step' => '0.01'])->label(\Yii::t('shop', 'Price'));
?>
            </div>
Example #4
0
 public function getProduct()
 {
     return $this->hasOne(Category::className(), ['id' => 'product_id']);
 }