src/Helper/ToolboxFile.php
public static function convertValuesToMetaModels($values)
    {
        if (!is_array($values)) {
            throw new InvalidArgumentException('Invalid uuid list.');
        }

        // Convert UUIDs to binary and clean empty values out.
        $values = array_filter(array_map(function ($fileId) {
            return Validator::isStringUuid($fileId) ? StringUtil::uuidToBin($fileId) : $fileId;
        }, $values));

        $result = array(
            'bin'   => array(),
            'value' => array(),
            'path'  => array(),
            'meta'  => array()
        );
        if (empty($values)) {
            return $result;
        }

        $models = FilesModel::findMultipleByUuids($values);

        if ($models === null) {
            return $result;
        }

        foreach ($models as $value) {
            $result['bin'][]   = $value->uuid;
            $result['value'][] = StringUtil::binToUuid($value->uuid);
            $result['path'][]  = $value->path;
            $result['meta'][]  = StringUtil::deserialize($value->meta, true);
        }

        return $result;
    }
public static function convertValuesToMetaModels($values)
    {
        if (!is_array($values)) {
            throw new InvalidArgumentException('Invalid uuid list.');
        }

        // Convert UUIDs to binary and clean empty values out.
        $values = array_filter(array_map(function ($fileId) {
            return Validator::isStringUuid($fileId) ? StringUtil::uuidToBin($fileId) : $fileId;
        }, $values));

        $result = array(
            'bin'   => array(),
            'value' => array(),
            'path'  => array(),
            'meta'  => array()
        );
        if (empty($values)) {
            return $result;
        }

        $models = FilesModel::findMultipleByUuids($values);

        if ($models === null) {
            return $result;
        }

        foreach ($models as $value) {
            $result['bin'][]   = $value->uuid;
            $result['value'][] = StringUtil::binToUuid($value->uuid);
            $result['path'][]  = $value->path;
            $result['meta'][]  = StringUtil::deserialize($value->meta, true);
        }

        return $result;
    }
Convert an array of values stored in the database (array of bin uuid) to a value to be handled by MetaModels.

The output array will have the following layout:
array(
'bin'   => array() // list of the binary ids.
'value' => array() // list of the uuids.
'path'  => array() // list of the paths.
'meta'  => array() // list of the meta data.
)

@param array $values The binary uuid values to convert.

@return array

@throws InvalidArgumentException When the input array is invalid.