diff --git a/Controller/AviaryController.php b/Controller/AviaryController.php index 482c4e18..3a5436f0 100644 --- a/Controller/AviaryController.php +++ b/Controller/AviaryController.php @@ -34,10 +34,20 @@ public function indexAction(Request $request, $folderId, $mediaId) $media = $em->getRepository('KunstmaanMediaBundle:Media')->getMedia($mediaId); /* @var MediaManager $mediaManager */ $mediaManager = $this->get('kunstmaan_media.media_manager'); + + $media = clone $media; $handler = $mediaManager->getHandler($media); $fileHelper = $handler->getFormHelper($media); $fileHelper->getMediaFromUrl($request->get('url')); $media = $fileHelper->getMedia(); + + $media->setUuid(null); + $handler->prepareMedia($media); + + $em->persist($media); + $em->flush(); + + $media->setCreatedAt($media->getUpdatedAt()); $em->persist($media); $em->flush();