This repository has been archived by the owner on Nov 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new event: ServiceWriterWritePreparedEvent
- Loading branch information
svensp
committed
Oct 16, 2019
1 parent
20f74b7
commit 3dc1ca4
Showing
3 changed files
with
116 additions
and
2 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
app/Blueprint/Infrastructure/Service/Events/ServiceWriterWritePreparedEvent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php namespace Rancherize\Blueprint\Infrastructure\Service\Events; | ||
|
||
use Rancherize\Blueprint\Infrastructure\Service\Service; | ||
use Rancherize\Blueprint\Infrastructure\Service\ServiceYamlDefinition; | ||
use Symfony\Component\EventDispatcher\Event; | ||
|
||
/** | ||
* Class ServiceWriterServicePreparedEvent | ||
* @package Rancherize\Blueprint\Infrastructure\Service\Events | ||
*/ | ||
class ServiceWriterWritePreparedEvent extends Event { | ||
|
||
const NAME = 'service-writer.prepared-to-write'; | ||
|
||
/** | ||
* @var Service | ||
*/ | ||
private $service; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
private $fileVersion = 2; | ||
/** | ||
* @var ServiceYamlDefinition | ||
*/ | ||
private $definition; | ||
|
||
/** | ||
* | ||
* /** | ||
* ServiceWriterServicePreparedEvent constructor. | ||
* @param Service $service | ||
* @param ServiceYamlDefinition $definition | ||
*/ | ||
public function __construct( Service $service, ServiceYamlDefinition $definition ) { | ||
$this->service = $service; | ||
$this->definition = $definition; | ||
} | ||
|
||
/** | ||
* @return Service | ||
*/ | ||
public function getService() { | ||
return $this->service; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getFileVersion(): int | ||
{ | ||
return $this->fileVersion; | ||
} | ||
|
||
/** | ||
* @return ServiceYamlDefinition | ||
*/ | ||
public function getDefinition(): ServiceYamlDefinition | ||
{ | ||
return $this->definition; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
app/Blueprint/Infrastructure/Service/ServiceYamlDefinition.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php namespace Rancherize\Blueprint\Infrastructure\Service; | ||
|
||
/** | ||
* Class ServiceYamlDefinition | ||
* @package Rancherize\Blueprint\Infrastructure\Service | ||
*/ | ||
class ServiceYamlDefinition | ||
{ | ||
|
||
/** | ||
* @var array | ||
*/ | ||
public $dockerComposeEntry = []; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
public $rancherComposeEntry = []; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
public $volumeDefinition = []; | ||
|
||
/** | ||
* @param $dockerComposeEntry | ||
* @param $rancherComposeEntry | ||
* @param $volumeDefinition | ||
* @return ServiceYamlDefinition | ||
*/ | ||
static function make($dockerComposeEntry, $rancherComposeEntry, $volumeDefinition) { | ||
$definition = new self; | ||
$definition->dockerComposeEntry = $dockerComposeEntry; | ||
$definition->rancherComposeEntry = $rancherComposeEntry; | ||
$definition->volumeDefinition = $volumeDefinition; | ||
return $definition; | ||
} | ||
|
||
} |