public static function convertUuidsOrPathsToMetaModels($values)
    {
        $values = array_filter((array) $values);
        if (empty($values)) {
            return array(
                'bin'   => array(),
                'value' => array(),
                'path'  => array(),
                'meta'  => array()
            );
        }

        foreach ($values as $key => $value) {
            if (!(Validator::isUuid($value))) {
                $file = FilesModel::findByPath($value) ?: Dbafs::addResource($value);
                if (!$file) {
                    throw new InvalidArgumentException('Invalid value.');
                }

                $values[$key] = $file->uuid;
            }
        }

        return self::convertValuesToMetaModels($values);
    }
public static function convertUuidsOrPathsToMetaModels($values)
    {
        $values = array_filter((array) $values);
        if (empty($values)) {
            return array(
                'bin'   => array(),
                'value' => array(),
                'path'  => array(),
                'meta'  => array()
            );
        }

        foreach ($values as $key => $value) {
            if (!(Validator::isUuid($value))) {
                $file = FilesModel::findByPath($value) ?: Dbafs::addResource($value);
                if (!$file) {
                    throw new InvalidArgumentException('Invalid value.');
                }

                $values[$key] = $file->uuid;
            }
        }

        return self::convertValuesToMetaModels($values);
    }
public static function convertUuidsOrPathsToMetaModels ( $ values ) { $ values = array_filter ( ( array ) $ values ) ; if ( empty ( $ values ) ) { return array ( 'bin' => array ( ) , 'value' => array ( ) , 'path' => array ( ) , 'meta' => array ( ) ) ; } foreach ( $ values as $ key => $ value ) { if ( ! ( Validator :: isUuid ( $ value ) ) ) { $ file = FilesModel :: findByPath ( $ value ) ? : Dbafs :: addResource ( $ value ) ; if ( ! $ file ) { throw new InvalidArgumentException ( 'Invalid value.' ) ; } $ values [ $ key ] = $ file -> uuid ; } } return self :: convertValuesToMetaModels ( $ values ) ; }
Convert an uuid or path 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 uuids or paths to convert.

@return array

@throws InvalidArgumentException When any of the input is not a valid uuid or an non existent file.
Convert an uuid or path to a value to be handled by MetaModels .