mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 01:04:12 +02:00
TableWithBranchSupport: provide setter
This commit is contained in:
parent
3c8bb6bd16
commit
131d4e27ba
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Icinga\Module\Director\Web\Table;
|
||||
|
||||
use Icinga\Module\Director\Db\Branch\Branch;
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
|
||||
trait TableWithBranchSupport
|
||||
@ -10,6 +11,21 @@ trait TableWithBranchSupport
|
||||
/** @var UuidInterface|null */
|
||||
protected $branchUuid;
|
||||
|
||||
/**
|
||||
* Convenience method, only UUID is required
|
||||
*
|
||||
* @param Branch|null $branch
|
||||
* @return $this
|
||||
*/
|
||||
public function setBranch(Branch $branch = null)
|
||||
{
|
||||
if ($branch && $branch->isBranch()) {
|
||||
$this->setBranchUuid($branch->getUuid());
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setBranchUuid(UuidInterface $uuid = null)
|
||||
{
|
||||
$this->branchUuid = $uuid;
|
||||
|
Loading…
x
Reference in New Issue
Block a user