From 85e05213541a0957b7d7cbc90ad21f67b62a7d80 Mon Sep 17 00:00:00 2001 From: Kristof Jochmans Date: Tue, 19 Aug 2014 15:16:47 +0200 Subject: [PATCH] create a new file and kuma_media entry when you click save in the aviary plugin --- Controller/AviaryController.php | 10 ++++++++++ 1 file changed, 10 insertions(+) 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();