/** * Regular populate overridden to determine the dynamic attributes first and add those. * After that the populate can continue normally. Please note that this will pickup ANY * attribute not returned as a regular one, even if it wasn't added as magic property * * @param \yii\db\BaseActiveRecord $record * @param array $row */ public static function populateRecord($record, $row) { if ($row) { // Just figure out the ones we don't already know about and register them so they also get picked up $dynamic = array_diff(array_keys($row), $record->attributes()); $record->addAttributes($dynamic); } // Now let the regular code do its job parent::populateRecord($record, $row); }