Esempio n. 1
0
 /**
  * @param string  $_id
  * @throws Syncroton_Exception_NotFound
  * @return Syncroton_Model_IDevice
  */
 public function get($id)
 {
     $id = $id instanceof $this->_modelInterfaceName ? $id->id : $id;
     $data = $this->_db->fetchAll(sprintf('SELECT * FROM %1$s %2$s', $this->_tablePrefix . $this->_tableName, $this->_db->conditions(array('id' => $id))), array(), array('cache' => false));
     if (empty($data)) {
         throw new Syncroton_Exception_NotFound('id not found');
     }
     return $this->_getObject(reset($data[0]));
 }
Esempio n. 2
0
 /**
  * Fetches all records from table.
  * @return array
  */
 public function fetchAll()
 {
     $this->buildQuery();
     return $this->dataSource->fetchAll();
 }