blob: 165c7ac5d5cc6e9e037360061078a2deead5768c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?php
namespace Icinga\Module\Director\Forms;
use Icinga\Module\Director\DirectorObject\Automation\Basket;
use Icinga\Module\Director\DirectorObject\Automation\BasketSnapshot;
use Icinga\Module\Director\Web\Form\DirectorForm;
class BasketCreateSnapshotForm extends DirectorForm
{
/** @var Basket */
private $basket;
public function setBasket(Basket $basket)
{
$this->basket = $basket;
return $this;
}
public function setup()
{
$this->setSubmitLabel($this->translate('Create Snapshot'));
}
/**
* @throws \Icinga\Module\Director\Exception\DuplicateKeyException
*/
public function onSuccess()
{
/** @var \Icinga\Module\Director\Db $connection */
$connection = $this->basket->getConnection();
$snapshot = BasketSnapshot::createForBasket($this->basket, $connection);
$snapshot->store();
parent::onSuccess();
}
}
|