/**
  * {@inheritDoc}
  */
 protected function doResolvePath(PropertyMapping $mapping, $dir, $name, $relative = false)
 {
     $path = !empty($dir) ? $dir . DIRECTORY_SEPARATOR . $name : $name;
     if ($relative) {
         return $path;
     }
     return $mapping->getUploadDestination() . DIRECTORY_SEPARATOR . $path;
 }
Exemplo n.º 2
0
 /**
  * Test that the configured mappings are accessed
  * correctly.
  */
 public function testConfiguredMappingAccess()
 {
     $object = new DummyEntity();
     $prop = new PropertyMapping('file', 'fileName');
     $prop->setMapping(array('upload_destination' => '/tmp', 'delete_on_remove' => true, 'delete_on_update' => true, 'inject_on_load' => false));
     $this->assertEquals('', $prop->getUploadDir($object));
     $this->assertEquals('/tmp', $prop->getUploadDestination());
     $this->assertEquals('file', $prop->getFilePropertyName());
     $this->assertEquals('fileName', $prop->getFileNamePropertyName());
     $this->assertTrue($prop->getDeleteOnRemove());
     $this->assertTrue($prop->getDeleteOnUpdate());
     $this->assertFalse($prop->getInjectOnLoad());
 }
Exemplo n.º 3
0
 /**
  * Get filesystem adapter by key
  *
  * @param string $key
  *
  * @return \League\Flysystem\FilesystemInterface
  */
 protected function getFilesystem(PropertyMapping $mapping)
 {
     return $this->mountManager->getFilesystem($mapping->getUploadDestination());
 }
Exemplo n.º 4
0
 /**
  * {@inheritDoc}
  */
 protected function doResolvePath(PropertyMapping $mapping, $dir, $name)
 {
     return $mapping->getUploadDestination() . DIRECTORY_SEPARATOR . $dir . $name;
 }
Exemplo n.º 5
0
 /**
  * Get filesystem adapter from the property mapping
  *
  * @param PropertyMapping $mapping
  *
  * @return \Gaufrette\Filesystem
  */
 protected function getFilesystem(PropertyMapping $mapping)
 {
     return $this->filesystemMap->get($mapping->getUploadDestination());
 }