Last active
December 10, 2015 05:28
-
-
Save aderuwe/4387336 to your computer and use it in GitHub Desktop.
Elegant workaround for https://github.com/dustin10/VichUploaderBundle/issues/8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function someAction() | |
{ | |
$filename = 'some-file'; | |
$file = new File($filename); | |
$customer->setLogo($file); | |
$storage = $this->container->get('vich_uploader.storage'); | |
$storage->upload($customer); | |
$em = $this->container->get('doctrine')->getManager(); | |
$em->transactional(function ($em) use ($customer) { | |
$em->persist($customer); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment