本文整理汇总了PHP中Chart::link方法的典型用法代码示例。如果您正苦于以下问题:PHP Chart::link方法的具体用法?PHP Chart::link怎么用?PHP Chart::link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chart
的用法示例。
在下文中一共展示了Chart::link方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$g->setKilometersTo(12423);
$g->setUserId($ut->getUserId('ruf'));
$g->link('Vehicles', array($ut->getVehicleId('vw-touran-1-4-tsi')));
$g->link('Categories', array($ut->getIdForCategory('Tax')));
$g->save();
$sha1 = $g->getHash();
$t->isa_ok($sha1, 'string', '->save() creates a sha for each chart');
$g->setKilometersFrom(235);
$g->save();
$sha2 = $g->getHash();
$t->cmp_ok($sha1, '!=', $sha2, '->save() The hash field is updated each time the object is changed');
$g = new Chart();
$g->setFormat('png');
$g->setKilometersTo(12423);
$g->setUserId($ut->getUserId('ruf'));
$g->link('Vehicles', array($ut->getVehicleId('vw-touran-1-4-tsi')));
$g->link('Categories', array($ut->getIdForCategory('Fuel')));
$sha = $g->getHash();
$g2 = new Chart();
$g2->setUserId($ut->getUserId('ruf'));
$g->save();
$finalsha = $g->getHash();
$t->isnt($sha, $finalsha, 'When saving the object, ->save() checks that a unique sha is set. If not, a new one is generated.');
// ->delete()
$t->diag('->delete()');
$g = new Chart();
$g->setUserId($ut->getUserId('ruf'));
$g->save();
$id = $g->getId();
$path = $g->getChartFileSystemPath();
$fs = new sfFilesystem(new sfEventDispatcher());
示例2: saveNewChart
protected function saveNewChart()
{
$chart = new Chart();
$params = $this->parameters;
$foreign = array('categories_list' => 'Categories', 'vehicles_list' => 'Vehicles');
$chart->fromArray($this->parameters);
foreach ($foreign as $field => $class) {
if (isset($params[$field])) {
$chart->link($class, $params[$field]);
}
}
try {
$chart->save();
} catch (Exception $exc) {
$sfe = new sfException();
throw $sfe->createFromException($exc);
}
$this->chart = $chart;
return $chart;
}