public function afterDelete() { parent::afterDelete(); Yii::$app->db->createCommand()->delete('{{%zoo_elements_categories}}', ['element_id' => $this->id])->execute(); }
public function getElements() { return $this->hasMany(Elements::className(), ['app_id' => 'id'])->indexBy('name'); }
<?php $fields = \worstinme\zoo\models\Elements::find()->where(['app_id' => Yii::$app->controller->application->id, 'type' => 'textfield'])->all(); $fields = \yii\helpers\ArrayHelper::map($fields, 'id', 'title'); ?> <?php echo $form->field($model, 'related_fields')->dropDownList($fields, ['multiple' => 'multiple']);