private function doMove(Institution $institution, Media $media, $sizes) { // point file system to new path $this->fileSystem->rename($institution->getId() . '/' . $media->getName(), $media->getName()); // do resize $this->institutionMediaService->resize($media, $sizes); }
/** * Rename a file * * TODO: Potentially fix https://github.com/KnpLabs/Gaufrette/issues/374 here. * * @param string $source_key * @param string $target_key * * @return $this */ public function rename($source_key, $target_key) { $this->filesystem->rename($source_key, $target_key); $metadata = null; if ($this->tagExists($source_key)) { $metadata = $this->getMetadata($source_key); $this->untag($source_key); } $this->tag($target_key, $metadata); return $this; }
/** * @test * @group functional */ public function shouldRenameFile() { $this->filesystem->write('foo', 'Some content'); $this->filesystem->rename('foo', 'boo'); $this->assertFalse($this->filesystem->has('foo')); $this->assertEquals('Some content', $this->filesystem->read('boo')); $this->filesystem->delete('boo'); $this->filesystem->write('foo', 'Some content'); $this->filesystem->rename('foo', 'somedir/sub/boo'); $this->assertFalse($this->filesystem->has('somedir/sub/foo')); $this->assertEquals('Some content', $this->filesystem->read('somedir/sub/boo')); $this->filesystem->delete('somedir/sub/boo'); }
/** * @When I rename :source to :dest */ public function iRename($source, $dest) { $this->filesystem->rename($source, $dest); }