summaryrefslogtreecommitdiff
path: root/core/models/item.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/models/item.php')
-rw-r--r--core/models/item.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/core/models/item.php b/core/models/item.php
index e29f3245..e188e0a3 100644
--- a/core/models/item.php
+++ b/core/models/item.php
@@ -215,10 +215,10 @@ class Item_Model extends ORM_MPTT {
if (empty($this->relative_path)) {
foreach ($this->parents() as $parent) {
if ($parent->id > 1) {
- $paths[] = $parent->name;
+ $paths[] = $parent->path;
}
}
- $paths[] = $this->name;
+ $paths[] = $this->path;
$this->relative_path = implode($paths, "/");
}
return $this->relative_path;
@@ -242,6 +242,16 @@ class Item_Model extends ORM_MPTT {
}
/**
+ * @see ORM::__get()
+ */
+ public function __set($column, $value) {
+ if ($column == "name") {
+ parent::__set("path", preg_replace("/[^A-Za-z0-9\.\-_]/", "_", $value));
+ }
+ parent::__set($column, $value);
+ }
+
+ /**
* @see ORM::save()
*/
public function save() {