/** * @param $requestToken * @return string */ public function getUrl($requestToken) { if (!$requestToken) { throw new \RuntimeException('No request token given'); } return \OCP\Util::linkToRoute('ocusagecharts.chart_api.load_chart', array('id' => $this->chart->getId(), 'requesttoken' => $requestToken)); }
/** * Save a chartconfig entity to the database * * @param ChartConfig $config * @return boolean */ public function save(ChartConfig $config) { $id = $config->getId(); if (!empty($id)) { $query = $this->db->prepareQuery('UPDATE *PREFIX*uc_chartconfig SET created = ?, username = ?, charttype = ?, chartprovider = ?, metadata = ? WHERE id = ?'); $query->execute(array($config->getDate()->format('Y-m-d H:i:s'), $config->getUsername(), $config->getChartType(), $config->getChartProvider(), $config->getMetaData(), $config->getId())); } else { $query = $this->db->prepareQuery('INSERT INTO *PREFIX*uc_chartconfig(created, username, charttype, chartprovider, metadata) VALUES (?,?,?,?,?)'); $query->execute(array($config->getDate()->format('Y-m-d H:i:s'), $config->getUsername(), $config->getChartType(), $config->getChartProvider(), $config->getMetaData())); } return true; }
public function testGetId() { $this->assertEquals('1', $this->chartConfig->getId()); }