예제 #1
0
 /**
  * Create a new onetimecall
  * @param \System\Db\Database The database to query
  * @param string The key which we should use to find the appropriate callback
  * @param string The value to reference the object with
  * @return \Module\Onetimecall\Onetimecall the newly created instance
  */
 public static function create(\System\Db\Database $db, $key, $value)
 {
     $hash = new \System\Security\Hash();
     $hash->addString(\System\Calendar\Time::now());
     $token = $hash->getHash();
     $query = new \System\Db\Query($db, SQL_ONETIMECALL_CREATE);
     $query->bind($token, \System\Db\QueryType::TYPE_STRING);
     $query->bind($key, \System\Db\QueryType::TYPE_STRING);
     $query->bind((string) $value, \System\Db\QueryType::TYPE_STRING);
     $db->query($query);
     $insertId = $db->getInsertId();
     return \Module\Onetimecall\Onetimecall::loadPrimary($db, $insertId);
 }