mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX #4486 Make use of DataObject::get_by_id() in File::getRelativePath() instead of building ID query manually in a get_one()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@84843 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
c9af2765b2
commit
f7dc370b16
@ -434,16 +434,12 @@ class File extends DataObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getRelativePath() {
|
function getRelativePath() {
|
||||||
|
|
||||||
if($this->ParentID) {
|
if($this->ParentID) {
|
||||||
$p = DataObject::get_one('Folder', "\"ID\"={$this->ParentID}");
|
$p = DataObject::get_by_id('Folder', $this->ParentID);
|
||||||
|
if($p && $p->exists()) return $p->getRelativePath() . $this->getField("Name");
|
||||||
if($p && $p->ID) return $p->getRelativePath() . $this->getField("Name");
|
|
||||||
else return ASSETS_DIR . "/" . $this->getField("Name");
|
else return ASSETS_DIR . "/" . $this->getField("Name");
|
||||||
|
|
||||||
} else if($this->getField("Name")) {
|
} else if($this->getField("Name")) {
|
||||||
return ASSETS_DIR . "/" . $this->getField("Name");
|
return ASSETS_DIR . "/" . $this->getField("Name");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return ASSETS_DIR;
|
return ASSETS_DIR;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user