/**
  * Cache a reference to the master db connection.
  */
 public function __construct()
 {
     AIR2_DBManager::$FORCE_MASTER_ONLY = true;
     $this->conn = AIR2_DBManager::get_master_connection();
     $this->src_table = Doctrine::getTable('Source');
 }
 /**
  * Calls set_src_status() (which just returns the status)
  * and then executes a SQL update directly on the source table.
  */
 public function set_and_save_src_status()
 {
     // this only works AFTER the source is saved
     if ($this->src_id) {
         AIR2_DBManager::$FORCE_MASTER_ONLY = true;
         $stat = $this->set_src_status();
         $conn = AIR2_DBManager::get_master_connection();
         $conn->execute("update source set src_status='{$stat}' where src_id=" . $this->src_id);
     }
 }
 /**
  * Force master DB
  *
  * @param string  $uuid
  * @param array   $data
  * @return array $response
  */
 public function update($uuid, $data)
 {
     $old = AIR2_DBManager::$FORCE_MASTER_ONLY;
     AIR2_DBManager::$FORCE_MASTER_ONLY = true;
     // run update, then revert setting
     $rs = parent::update($uuid, $data);
     AIR2_DBManager::$FORCE_MASTER_ONLY = $old;
     return $rs;
 }