X-Git-Url: https://dev.renevier.net/?p=syj.git;a=blobdiff_plain;f=application%2Fmodels%2FPathMapper.php;h=1e0e973c4489dc0e1bb9673cefcbeb30c949a72d;hp=c89936455905e9c060110665e9d194b864d6adb2;hb=ec061a75fe57a25eb7ef0894f5e723397ba35472;hpb=3ff82e2d9fa289beba4e965b82772cf83f905b2f diff --git a/application/models/PathMapper.php b/application/models/PathMapper.php index c899364..1e0e973 100644 --- a/application/models/PathMapper.php +++ b/application/models/PathMapper.php @@ -42,9 +42,18 @@ class Syj_Model_PathMapper return $this->_fetchItem($select, $path); } - public function fetchAll() { + public function fetchByCreator(Syj_Model_User $user) { $select = $this->_select(); + $select->where('creator = ?', (int)$user->id)->order('id'); + return $this->fetchAll($select); + } + + public function fetchAll(Zend_Db_Table_Select $select) { + if (!isset($select)) { + $select = $this->_select(); + } + $table = $this->getDbTable(); $resultSet = $table->fetchAll($select); $entries = array(); @@ -69,6 +78,10 @@ class Syj_Model_PathMapper } } + public function delete (Syj_Model_Path $path) { + $this->getDbTable()->delete(array('id = ?' => $path->getId())); + } + protected function _itemFromRow(Syj_Model_Path $item, Zend_Db_Table_Row $row) { $decoder = new gisconverter\WKT(); $geom = $decoder->geomFromText($row->wkt);