public static findMultipleByIds ( array $arrIds, array $arrOptions = [] ) : |
||
$arrIds | array | An array of IDs or UUIDs |
$arrOptions | array | An optional options array |
return | A collection of models or null if there are no files |
public static function findMultipleByIds($arrIds, array $arrOptions = array())
{
if (!is_array($arrIds) || empty($arrIds)) {
return null;
}
if (\Validator::isUuid(current($arrIds))) {
return static::findMultipleByUuids($arrIds, $arrOptions);
}
return parent::findMultipleByIds($arrIds, $arrOptions);
}
/** * Translate the file IDs to file paths */ protected function convertValuesToPaths() { if (empty($this->varValue)) { return; } if (!is_array($this->varValue)) { $this->varValue = array($this->varValue); } elseif (empty($this->varValue[0])) { $this->varValue = array(); } if (empty($this->varValue)) { return; } // TinyMCE will pass the path instead of the ID if (strncmp($this->varValue[0], \Config::get('uploadPath') . '/', strlen(\Config::get('uploadPath')) + 1) === 0) { return; } // Ignore the numeric IDs when in switch mode (TinyMCE) if (\Input::get('switch')) { return; } $objFiles = \FilesModel::findMultipleByIds($this->varValue); if ($objFiles !== null) { $this->varValue = array_values($objFiles->fetchEach('path')); } }