Ejemplo n.º 1
0
 public static function getOrgSyncKey()
 {
     $db = PdoFactory::getPdoInstance();
     $query = 'SELECT * FROM appsync_umbrella WHERE setting = orgsync_key';
     $stmt = $db->prepare($query);
     $stmt->execute();
     $stmt->setFetchMode(\PDO::FETCH_CLASS, 'AppSync\\SettingRestored');
     return $stmt->fetchAll();
 }
Ejemplo n.º 2
0
 /**
  * Saves a setting to the database, if the setting object already exists updates
  * it with the new values.
  */
 public static function save($setting)
 {
     $db = PdoFactory::getPdoInstance();
     $id = $setting->getId();
     if (isset($id)) {
         $query = 'UPDATE appsync_settings SET value = :value WHERE id = :id';
         $params = array('id' => $id, 'value' => $setting->getValue());
     } else {
         // Insert
         $query = "INSERT INTO appsync_settings (id, setting, value) VALUES (nextval('appsync_settings_seq'), :setting, :value)";
         $params = array('setting' => $setting->getSetting(), 'value' => $setting->getValue());
     }
     $stmt = $db->prepare($query);
     $stmt->execute($params);
 }
Ejemplo n.º 3
0
 /**
  * Saves a portal to the database, if the portal object already exists updates
  * it with the new values.
  */
 public static function save($portal)
 {
     $db = PdoFactory::getPdoInstance();
     $orgsync_id = $portal->getOrgSyncId();
     if (!empty(self::getPortalById($orgsync_id))) {
         $query = "UPDATE appsync_portal SET (name, umbrella_id) = (:name, :umbrellaId) WHERE orgsync_id = :orgsyncId";
         $params = array('name' => $portal->getName(), 'umbrellaId' => $portal->getUmbrellaId(), 'orgsyncId' => $orgsync_id);
     } else {
         // Insert
         $query = "INSERT INTO appsync_portal (orgsync_id, name, umbrella_id) VALUES (:orgsyncId, :name, :umbrellaId)";
         $params = array('name' => $portal->getName(), 'orgsyncId' => $portal->getOrgSyncId(), 'umbrellaId' => $portal->getUmbrellaId());
     }
     $stmt = $db->prepare($query);
     $stmt->execute($params);
 }
Ejemplo n.º 4
0
 /**
  * Saves a LogEntry to the database, if the logEntry object already exists updates
  * it with the new values.
  */
 public static function save($logEntry)
 {
     $db = PdoFactory::getPdoInstance();
     $id = $logEntry->getId();
     if (isset($id)) {
         $query = 'UPDATE appsync_log_entry SET (description, username, occurred_on) = (:description, :username, :occurredOn) WHERE id = :id';
         $params = array('id' => $id, 'description' => $logEntry->getDescription(), 'username' => $logEntry->getUsername(), 'occurredOn' => $logEntry->getOccurredOn());
     } else {
         // Insert
         $query = "INSERT INTO appsync_log_entry (id, description, username, occurred_on) VALUES (nextval('appsync_log_entry_seq'), :description, :username, :occurredOn)";
         $params = array('description' => $logEntry->getDescription(), 'username' => $logEntry->getUsername(), 'occurredOn' => $logEntry->getOccurredOn());
     }
     $stmt = $db->prepare($query);
     $stmt->execute($params);
     // Update ID for a new object
     if (!isset($id)) {
         $logEntry->setId($db->lastInsertId('appsync_log_entry_seq'));
     }
 }
Ejemplo n.º 5
0
 public static function save($umbrella)
 {
     $db = PdoFactory::getPdoInstance();
     $id = $umbrella->getId();
     if (isset($id)) {
         $query = "UPDATE appsync_umbrella SET (name, orgsync_id) = (:name, :orgsyncId) WHERE id = :id";
         $params = array('name' => $contract->getName(), 'orgsyncId' => $contract->getOrgSyncId());
     } else {
         // Insert
         $query = "INSERT INTO appsync_umbrella (id, name, orgsync_id) VALUES (nextval('appsync_umbrella_seq'), :name, :orgsyncId)";
         $params = array('name' => $contract->getName(), 'orgsyncId' => $contract->getOrgSyncId());
     }
     $stmt = $db->prepare($query);
     $stmt->execute($params);
     // Update ID for a new object
     if (!isset($id)) {
         $umbrella->setId($db->lastInsertId('appsync_umbrella_seq'));
     }
 }
 /**
  * Saves an umbrellaAdmin to the database, if the umbrellaAdmin object already exists updates
  * it with the new values.
  */
 public static function save($umbrellaAdmin)
 {
     $db = PdoFactory::getPdoInstance();
     $id = $umbrellaAdmin->getId();
     if (isset($id)) {
         $query = "UPDATE appsync_umbrella_admin SET (username, umbrella_id ) = (:username, :umbrellaId) WHERE id = :id";
         $params = array('id' => $id, 'username' => $umbrellaAdmin->getUsername(), 'umbrellaId' => $umbrellaAdmin->getUmbrellaId());
     } else {
         // Insert
         $query = "INSERT INTO appsync_umbrella_admin (id, username, umbrella_id) VALUES (nextval('appsync_umbrella_admin_seq'), :username, :umbrellaId)";
         $params = array('username' => $umbrellaAdmin->getUsername(), 'umbrellaId' => $umbrellaAdmin->getUmbrellaId());
     }
     $stmt = $db->prepare($query);
     $stmt->execute($params);
     // Update ID for a new object
     if (!isset($id)) {
         $umbrellaAdmin->setId($db->lastInsertId('appsync_umbrella_admin_seq'));
     }
 }