2019-07-17 20:08:50 +00:00
|
|
|
<?php
|
|
|
|
|
2019-07-17 20:31:04 +00:00
|
|
|
/*
|
|
|
|
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
|
|
|
* @license http://creativecommons.org/licenses/BSD/ BSD Licensese
|
|
|
|
* @author Keyboard Monkeys Ltd.
|
|
|
|
* @package Monkeys Framework
|
|
|
|
* @packager Keyboard Monkeys
|
|
|
|
*/
|
|
|
|
|
2019-07-17 20:08:50 +00:00
|
|
|
abstract class Monkeys_Db_Table_Gateway extends Zend_Db_Table_Abstract
|
|
|
|
{
|
2019-07-17 20:31:04 +00:00
|
|
|
const ASC = 'ASC';
|
|
|
|
const DESC = 'DESC';
|
|
|
|
|
2019-07-17 20:08:50 +00:00
|
|
|
public function getRowInstance($id)
|
|
|
|
{
|
2019-07-17 20:31:04 +00:00
|
|
|
return $this->find($id)->current();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getRandomRowInstance(Projects_Model_Project $project)
|
|
|
|
{
|
|
|
|
$select = $this->select()->where('project_id=?', $project->id)->order(new Zend_Db_Expr('RAND()'));
|
|
|
|
|
|
|
|
return $this->fetchRow($select);
|
2019-07-17 20:08:50 +00:00
|
|
|
}
|
|
|
|
}
|