protected function createArrayOfValues(File $file, Application $app) { $visitor = $app['user.service']->identifyUser($app['request']->cookies->all(), false); $user = $file->getUser(); $userName = $user->getName(); $mediaInfo = $app['file.service']->getArrayOfMediaInfo($file); $values = array('downloadUrl' => "{$app['request']->getUri()}/download/{$file->getOriginalName()}", 'removeUrl' => "{$app['request']->getUri()}/remove", 'userName' => $userName === null ? "Anonymous" : $userName, 'file' => $file, 'mediaInfo' => $mediaInfo, 'mediaInfoAudioKeys' => isset($mediaInfo['audio']) ? array_keys($mediaInfo['audio']) : array(), 'mediaInfoVideoKeys' => isset($mediaInfo['video']) ? array_keys($mediaInfo['video']) : array(), 'userId' => $user->getId(), 'visitorId' => $visitor->getId(), 'thumbURL' => $file->getThumbnailPath() === null ? "" : "{$app['request']->getUri()}/thumb", 'realsizeURL' => $file->getThumbnailPath() === null ? "" : "{$app['request']->getUri()}/realsize", 'numberOfComments' => count($file->getComments())); return $values; }