Example #1
0
 public function save(Connection $connection)
 {
     $select = $this->selectExecute($connection->getName());
     $id = $select->fetchColumn(0);
     $params = array();
     if ($id) {
         $params['id'] = $id;
         $statement = $this->getUpdate();
     } else {
         $statement = $this->getInsert();
     }
     $params['name'] = $connection->getName();
     $params['offer'] = $connection->getOffer();
     $params['answer'] = $connection->getAnswer();
     $params['candidates'] = serialize($connection->getCandidates());
     $result = $statement->execute($params);
     if (!$result) {
         throw new \Exception("failed to save connection record.");
     }
 }
Example #2
0
 /**
  * @param Connection $connection
  * @param string $candidate - RTCIceCandidate json
  * @return void
  */
 public function addIceCandidate(Connection $connection, $candidate)
 {
     $connection->addCandidate($candidate);
     $this->save($connection);
 }
Example #3
0
 public function save(Connection $connection)
 {
     $connections = $this->getAllConnections();
     $connections[$connection->getName()] = $connection;
     $this->saveAllConnections($connections);
 }