-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mauro Cassani
committed
Aug 25, 2017
1 parent
d4a017f
commit 8b69f1b
Showing
10 changed files
with
234 additions
and
136 deletions.
There are no files selected for viewing
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
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
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
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
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
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,80 @@ | ||
<?php | ||
/** | ||
* This file is part of the Simple EventStore EventStoreManager package. | ||
* | ||
* (c) Mauro Cassani<https://github.com/mauretto78> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace SimpleEventStoreManager\Bundle\Service; | ||
|
||
use SimpleEventStoreManager\Application\Event\EventManager as EM; | ||
use SimpleEventStoreManager\Application\Event\EventQuery as EQ; | ||
use SimpleEventStoreManager\Application\Event\EventQuery; | ||
use SimpleEventStoreManager\Domain\Model\Contracts\EventAggregateRepositoryInterface; | ||
|
||
class EventStoreManager | ||
{ | ||
/** | ||
* @var EM | ||
*/ | ||
private $eventManager; | ||
|
||
/** | ||
* @var EQ | ||
*/ | ||
private $eventQuery; | ||
|
||
/** | ||
* EventStoreManager constructor. | ||
* | ||
* @param array $config | ||
*/ | ||
public function __construct(array $config = []) | ||
{ | ||
$this->setEventMananger($config); | ||
$this->setEventQuery($this->eventManager); | ||
} | ||
|
||
/** | ||
* @param $config | ||
*/ | ||
private function setEventMananger($config) | ||
{ | ||
$returnType = ($config['return_type'] === 'array') ? EventAggregateRepositoryInterface::RETURN_AS_ARRAY : EventAggregateRepositoryInterface::RETURN_AS_OBJECT; | ||
$this->eventManager = EM::build() | ||
->setDriver($config['driver']) | ||
->setConnection($config['parameters']) | ||
->setReturnType($returnType); | ||
|
||
if($config['elastic']){ | ||
$this->eventManager->setElasticServer($config['elastic']); | ||
} | ||
} | ||
|
||
/** | ||
* @return EM | ||
*/ | ||
public function getEventMananger() | ||
{ | ||
return $this->eventManager; | ||
} | ||
|
||
/** | ||
* @param EM $eventManager | ||
*/ | ||
private function setEventQuery(EM $eventManager) | ||
{ | ||
$this->eventQuery = new EventQuery($eventManager); | ||
} | ||
|
||
/** | ||
* @return EQ | ||
*/ | ||
public function getEventQuery() | ||
{ | ||
return $this->eventQuery; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.