/** * Returns list of dir entities. * Available filters: * @code@ * name * parent_id * owner_id * cdate * mdate * type * @endcode@ * * @param dir RM_ObjectFs_Dir Dir * @return RM_Store_iRequest<RM_ObjecFs_Entity> */ public function dirGetFiles(RM_ObjectFs_Dir $dir) { return $this->requestFiles()->filter('parent_id = ?', $dir->id()); }
/** * Moves or/and renames entity. For safe move: * $file->move($target, ''); // generates unique filename in target * * @param target RM_ObjectFs_Dir Target dir. Pass NULL if you don't want to move entity * @param name string New name. Pass empty string if you want to generate name automatically. * @return void */ public function move(RM_ObjectFs_Dir $target = NULL, $newName = NULL) { $this->_mapper->access($this, 'OFS-WRITE-INFO'); // rename if ($newName !== NULL) { $this->_props['name'] = $newName == '' ? NULL : $newName; } // move if ($target and $this->_props['parent_id'] != $target->id()) { $this->_mapper->access($this->getParent(), 'OFS-WRITE-CONTENT'); $this->_mapper->access($target, 'OFS-WRITE-CONTENT'); $this->_props['parent_id'] = $target->id(); $this->_props['fs_id'] = $target->_getFsId(); if ($this->_accessInherit()) { $this->_accessId($target->_accessId()); } } try { $this->save(); } catch (RM_Db_Exception_ConstraintViolation $e) { throw new RM_ObjectFs_Exception_FileExists($this->getParent(), $this); } }