<?php
-/* This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
+/* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
and is published under the AGPL license. */
class Syj_Model_PathMapper
$db = $this->getDbTable()->getAdapter();
$expr = $db->quoteInto('seq_attained_value(?)', array('paths_id_seq', (int)$id));
$select = $db->select()->from(new Zend_Db_Expr($expr));
- print $select->assemble();
$row = $db->fetchRow($select);
return $row['t'];
}
return $this->_fetchItem($select, $path);
}
+ public function findByTitle($title, Syj_Model_Path $path) {
+ $select = $this->_select();
+ $select->where('title = ?', (string)$title);
+ return $this->_fetchItem($select, $path);
+ }
+
public function findByUrl($url, Syj_Model_Path $path) {
$select = $this->_select();
$select->where('id = ?', (int)$url)->orWhere('urlcomp = ?', (string)$url);
public function save (Syj_Model_Path $path) {
$data = array(
'geom'=> (string)$path->geom,
- 'creator'=> $path->creator->id,
+ 'creator'=> $path->creator? $path->creator->id: null,
'title'=> $path->title,
'creator_ip'=> $path->creatorIp
);