public function load(File $file)
 {
     #ToDO prueba de concepto sacar a un servicio
     $manager = $this->orphanManager->get('gallery');
     $fs = new Filesystem();
     $fs->copy($file->getAbsolutePath(), $this->config['directory'] . '/' . $this->session->getId() . '/gallery/' . $file->getName());
 }
Example #2
0
 /**
  * Turn this item object into a generic array
  *
  * @return array
  */
 public function transform(File $file = null)
 {
     if ($file === null) {
         return [];
     }
     return ['id' => (int) $file->getId(), 'mimeType' => $file->getMimeType(), 'size' => $file->getSize(), 'name' => $file->getName(), 'uri' => $file->getUri()];
 }
Example #3
0
 public function delete(File $entity, $eventName = 'app.entity.deleted')
 {
     $filePath = $entity->getPath() . DIRECTORY_SEPARATOR . $entity->getName();
     $this->simpleDelete($entity, $eventName);
     unlink($filePath);
 }