8000 Changed the methods in order to getAbsolutePath returns the full path… · symfony/symfony-docs@8bef86b · GitHub
[go: up one dir, main page]

Skip to content

Commit 8bef86b

Browse files
committed
Changed the methods in order to getAbsolutePath returns the full path (because it's needed when unlink()
1 parent 24a1f96 commit 8bef86b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

cookbook/doctrine/file_uploads.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,23 @@ First, create a simple Doctrine Entity class to work with::
4848
*/
4949
public $path;
5050

51-
public function getFullPath()
51+
public function getAbsolutePath()
52+
{
53+
return null === $this->path ? null : $this->getUploadRootDir().'/'.$this->path;
54+
}
55+
56+
public function getWebPath()
5257
{
53-
return null === $this->path ? null : $this->getWebLocation().'/'.$this->path;
58+
return null === $this->path ? null : $this->getWebPath().'/'.$this->path;
5459
}
5560

5661
protected function getUploadRootDir()
5762
{
5863
// the absolute directory path where uploaded documents should be saved
59-
return __DIR__.'/../../../../web/'.$this->getWebLocation();
64+
return __DIR__.'/../../../../web/'.$this->getUploadDir();
6065
}
6166

62-
protected function getWebLocation()
67+
protected function getUploadDir()
6368
{
6469
// get rid of the __DIR__ so it doesn't screw when displaying uploaded doc/image in the view.
6570
return 'uploads/documents';

0 commit comments

Comments
 (0)
0