-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed the methods in order to getAbsolutePath returns the full path…
… (because it's needed when unlink()
- Loading branch information
1 parent
24a1f96
commit 8bef86b
Showing
1 changed file
with
9 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,18 +48,23 @@ First, create a simple Doctrine Entity class to work with:: | |
*/ | ||
public $path; | ||
|
||
public function getFullPath() | ||
public function getAbsolutePath() | ||
{ | ||
return null === $this->path ? null : $this->getUploadRootDir().'/'.$this->path; | ||
} | ||
|
||
public function getWebPath() | ||
{ | ||
return null === $this->path ? null : $this->getWebLocation().'/'.$this->path; | ||
return null === $this->path ? null : $this->getWebPath().'/'.$this->path; | ||
} | ||
|
||
protected function getUploadRootDir() | ||
{ | ||
// the absolute directory path where uploaded documents should be saved | ||
return __DIR__.'/../../../../web/'.$this->getWebLocation(); | ||
return __DIR__.'/../../../../web/'.$this->getUploadDir(); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
stof
Member
|
||
} | ||
|
||
protected function getWebLocation() | ||
protected function getUploadDir() | ||
{ | ||
// get rid of the __DIR__ so it doesn't screw when displaying uploaded doc/image in the view. | ||
return 'uploads/documents'; | ||
|
Is there not something better than ../../../.. that can be used here? Like injecting the kernel root or using the assetic assets path?