/** * Transforms an object (file) * * @param File $file * * @return File */ public function transform($file) { if ($file instanceof File) { return array($file->getWebPath()); } else { if ($file instanceof ArrayCollection) { $data = array(); foreach ($file as $f) { $data[] = $f->getWebPath(); } return $data; } } }