1 <?php # vim:ts=2:sw=2:et:
2 /* For licensing and copyright terms, see the file named LICENSE */
8 static function loadByWord($word)
10 foreach (MTrackDB::q('select kid from keywords where keyword = ?', $word)
11 ->fetchAll() as $row) {
12 return new MTrackKeyword($row[0]);
17 function __construct($id = null)
20 list($row) = MTrackDB::q('select keyword from keywords where kid = ?',
23 $this->keyword = $row[0];
28 function save(MTrackChangeset $CS)
30 if ($this->kid === null) {
31 MTrackDB::q('insert into keywords (keyword) values (?)', $this->keyword);
32 $this->kid = MTrackDB::lastInsertId('keywords', 'kid');
33 $CS->add("keywords:keyword", null, $this->keyword);
35 throw new Exception("not allowed to rename keywords");