public function resolve(& $value)
    {
        $extraData = array();
        $files = array();
        if (is_array($value)) {
            if (!empty($value['file_id'])) {
                $extraDataTmp = array();
                foreach ($value as $extraDataKey => $extraDataValue) {
                    if ($extraDataKey !== 'file_id') {
                        $extraDataTmp[$extraDataKey] = $extraDataValue;
                    }
                }

                $extraData = $extraDataTmp;
                $files[] = call_user_func(array($this->fileModel, 'findById'), $value['file_id']);
            } else {
                foreach ($value as $index => $file) {
                    if (!empty($file['file_id'])) {
                        $modelFile = call_user_func(array($this->fileModel, 'findById'), $file['file_id']);

                        $extraDataTmp = array();
                        foreach ($file as $extraDataKey => $extraDataValue) {
                            if ($extraDataKey !== 'file_id') {
                                $extraDataTmp[$extraDataKey] = $extraDataValue;
                            }
                        }

                        $extraData[$index] = $extraDataTmp;
                        $files[] = $modelFile;
                    }
                }
            }
        }

        $decoratedFiles = new \ArrayObject();
        foreach ($files as $index => $file) {
            if (!$file instanceof $this->fileModel) {
                continue;
            }


            $decoratedFiles->append(new Decorator($file, $extraData[$index]));
        }
        $value = $decoratedFiles;

        return $value;
    }
public function resolve(& $value)
    {
        $extraData = array();
        $files = array();
        if (is_array($value)) {
            if (!empty($value['file_id'])) {
                $extraDataTmp = array();
                foreach ($value as $extraDataKey => $extraDataValue) {
                    if ($extraDataKey !== 'file_id') {
                        $extraDataTmp[$extraDataKey] = $extraDataValue;
                    }
                }

                $extraData = $extraDataTmp;
                $files[] = call_user_func(array($this->fileModel, 'findById'), $value['file_id']);
            } else {
                foreach ($value as $index => $file) {
                    if (!empty($file['file_id'])) {
                        $modelFile = call_user_func(array($this->fileModel, 'findById'), $file['file_id']);

                        $extraDataTmp = array();
                        foreach ($file as $extraDataKey => $extraDataValue) {
                            if ($extraDataKey !== 'file_id') {
                                $extraDataTmp[$extraDataKey] = $extraDataValue;
                            }
                        }

                        $extraData[$index] = $extraDataTmp;
                        $files[] = $modelFile;
                    }
                }
            }
        }

        $decoratedFiles = new \ArrayObject();
        foreach ($files as $index => $file) {
            if (!$file instanceof $this->fileModel) {
                continue;
            }


            $decoratedFiles->append(new Decorator($file, $extraData[$index]));
        }
        $value = $decoratedFiles;

        return $value;
    }
{@inheritdoc}