public function getParts($withChild = false) { $result = $this->hasMany(ServicesPartsRecord::className(), ['serviceId' => 'id', 'lang' => 'lang'])->position(); if (!$withChild) { $result->andWhere(['parentId' => 0]); } return $result; }
public function getChilds() { return $this->hasMany(ServicesPartsRecord::className(), ['parentId' => 'id', 'lang' => 'lang'])->position(); }