/** * Parse an array with fileId and caption into an {{\luya\admin\file\Iterator}} object. * * @param array $values The array with key 'fileId' like `[['fileId' => 1, 'caption' => 'test']]`. * @return \luya\admin\file\Iterator The iterator object from the parsed values or an empty array if empty. */ protected function parseFileIteration(array $values) { if (empty($values)) { return []; } return (new Query())->where(['in', 'id', ArrayHelper::getColumn($values, 'fileId')])->all(); }
private function getExtraAssignData() { $ids = ArrayHelper::getColumn($this->getContextConfigValue($this->varName, []), 'value'); $provider = new ActiveDataProvider(['query' => $this->_query->andWhere(['in', 'id', $ids])]); return $provider->getModels(); }
/** * Get an array with all ids for the storage component. Only the image ids for the current * model/item id should be returned: * * ```php * return [1,2,3]; // where 1,2,3 are ids of the image from the storage component * ``` * * @return array An array where only the images are returned. */ public function flowListImages() { return ArrayHelper::getColumn((new Query())->select([$this->getConfigValue('imageField')])->from($this->getConfigValue('table'))->where([$this->getConfigValue('itemField') => $this->id])->indexBy($this->getConfigValue('imageField'))->all(), $this->getConfigValue('imageField')); }