extranet/application/models/CommandesKbis.php
2011-09-29 15:15:14 +00:00

35 lines
927 B
PHP

<?php
class Application_Model_CommandesKbis extends Zend_Db_Table_Abstract
{
protected $_name = 'commandes_kbis';
public function __construct()
{
if (empty($config) && Zend_Registry::isRegistered('configuration')){
$configuration = Zend_Registry::get('configuration');
$this->_db = Zend_Db::factory($configuration->databases->db->sdv1);
} elseif(empty($config)){
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH.'/configs/configuration.ini', 'databases');
$this->_db = Zend_Db::factory($dbConfig->db->sdv1);
}
}
public function getCommandesKbisById($id)
{
$sql = $this->select()
->where('id = ?', $id);
$result = $this->getAdapter()->fetchAll($sql);
return $result;
}
public function getCommandesKbisBySiren($siren)
{
$sql = $this->select()
->where('siren = ?', $siren)
->order('dateCommande ASC');
$result = $this->getAdapter()->fetchAll($sql);
return $result;
}
}