Skip to content

Instantly share code, notes, and snippets.

@aderuwe
Last active December 10, 2015 05:28
Show Gist options
  • Save aderuwe/4387336 to your computer and use it in GitHub Desktop.
Save aderuwe/4387336 to your computer and use it in GitHub Desktop.
<?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