Skip to content

Instantly share code, notes, and snippets.

@damianoporta
Created April 2, 2015 09:14
Show Gist options
  • Save damianoporta/55bae60380ecd2e9b4d5 to your computer and use it in GitHub Desktop.
Save damianoporta/55bae60380ecd2e9b4d5 to your computer and use it in GitHub Desktop.
<?php
$ext = pathinfo($entity->get($field)['name'], PATHINFO_EXTENSION);
if($entity->has('company')) {
$newFileName = $entity->get($field)['name'];
}
else {
$newFileName = Inflector::slug($entity->company) . ".$ext";
}
$entity->get($field)['name'] = $newFileName;
$this->setFilename($newFileName);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment