Skip to content

outsourced configuration from ConfigurableAggregateTranslator - #238

Merged
prolic merged 3 commits into
prooph:masterfrom
dropdevcoding:outsource_aggregate_translator_configuration
Jan 3, 2017
Merged

outsourced configuration from ConfigurableAggregateTranslator#238
prolic merged 3 commits into
prooph:masterfrom
dropdevcoding:outsource_aggregate_translator_configuration

Conversation

@dropdevcoding

Copy link
Copy Markdown
Contributor

some more tests and docs have to be added

some more tests and docs have to be added
…performance

added some more tests
added doc blocks

@prolic prolic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally I am okay with this change. If performance is a real issue for you (and I don't think this makes much of a difference) you can still implement the Translator-interface yourself.


$instance = clone $this;
$instance->messageToEventCallback = $messageToEventCallback;
return $instance;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add new line before return


$instance = clone $this;
$instance->eventToMessageCallback = $eventToMessageCallback;
return $instance;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add new line before return


$instance = clone $this;
$instance->staticReconstituteFromHistoryMethodName = $staticReconstituteFromHistoryMethodName;
return $instance;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add new line before return


$instance = clone $this;
$instance->replayEventsMethodName = $replayEventsMethodName;
return $instance;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add new line before return


$instance = clone $this;
$instance->popRecordedEventsMethodName = $popRecordedEventsMethodName;
return $instance;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add new line before return

*/
public function it_returns_configured_message_to_event_callback()
{
$callback = function () {};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return void

$this->config->messageToEventCallback()
);
}
} No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add new line at end of file

* @var AggregateTranslatorConfiguration
*/
private $configProphecy;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return void


$historyEvents = new \ArrayIterator([$historyEvent->reveal()]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove spaces

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove @expectedException in phpdoc and use $this->expectException(...) instead.

@prolic

prolic commented Jan 3, 2017

Copy link
Copy Markdown
Member

Travis build failed, too.

@dropdevcoding

Copy link
Copy Markdown
Contributor Author

Allright, thanx for reviewing. I'll provide the fixes in the evening.

fixed stuff reviewed by @prolic
@prolic
prolic merged commit cb4c50b into prooph:master Jan 3, 2017
@prolic

prolic commented Jan 3, 2017

Copy link
Copy Markdown
Member

@dropdevcoding Fun for another PR updating the copyright to 2017 instead of 2016?
Should be easy and fast to do :)

@prolic

prolic commented Jan 3, 2017

Copy link
Copy Markdown
Member

ah god damn it - this is a BC break because the constructor did change.

@codeliner revert it?

@codeliner codeliner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dropdevcoding I've added some comments and an idea how to avoid the BC break. Feel free to submit a second PR that we can merge without breaking BC. Please also add a note in the docs then submit a second PR

$eventToMessageCallback = null,
$messageToEventCallback = null
) {
$this->versionMethodName = $versionMethodName;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type assertions are missing. Best thing is to add a private set* method for each methodname and assert minLength their. Then you can use the setter in the constructor and in the with* methods

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type assertions aren't missing, they are made within the dedicated with* methods for each property. I think this shouldn't be a problem since the constructor of configuration is private and only called within the factory method for default configuration.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then you should make it private :P, currently I see public function __construct(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constructor needs to stay public, otherwise BC again!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hehe, not the one of AggregateTranslatorConfiguration because this is a new class ;)

$staticReconstituteFromHistoryMethodName = null,
$eventToMessageCallback = null,
$messageToEventCallback = null)
public function __construct(AggregateTranslatorConfiguration $configuration = null)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BC break! to avoid this BC break we can do the following. Keep constructor as-is.
Add a static named constructor:

ConfigurableAggregateTranslator::fromConfiguration(AggregateTranslatorConfiguration $configuration)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll propose some changes soon. Please have a look again then.

@dropdevcoding dropdevcoding Jan 3, 2017

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have a look again. I admit it's kind of back and forth using the config without having a BC break but the intention is to have the config as single point of validation for itself (see #242).
Thanks for the hint @codeliner I changed the config's constructor to private.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants