Text only
Yii2 Array Map to Model
/raw/4b6b292e9d5b1e3b741e1fbf84732d34/
4b6b292e9d5b1e3b741e1fbf84732d34
text
Text only
1
2025-04-03T18:49:38
True
False
False
Feb 09, 2021 at 08:09 PM
/api/public/snipt/115/
yii2-array-map-to-model
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>$categories = ArrayHelper::map(Category1::find()->where(['class_id' => $class_id])->all(), 'category_1_id', 'name');
</span></pre></div>
</td></tr></table>