-
Notifications
You must be signed in to change notification settings - Fork 42
Reuse trait instead of duplicating code #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Be careful, the |
I don't think simply changing the method's visibility to |
I'm not using traits much... but maybe leaving the method use PrivateMessageRecorderCapabilities { record as public; } would work? |
I agree with your notices, but let's have a look at the documentation: http://simplebus.github.io/MessageBus/doc/message_recorder.html class YourEntity implements RecordsMessages
{
...
} The documentation says that |
@jdreesen yeah, looks like a good solution. Let's wait the travis build |
Oh, you are right, but I think the docs are wrong here because the section describes privately recording messages (which is generally what you want to do in a domain entity - it should be able to record it's own messages, but no one else should be allowed to do this). |
@jdreesen ok, I applied your suggestion and now the Entity will still have //cc @matthiasnoback |
I'm no maintainer of this project, and no great fan of traits, but as the trait exists anyways and differs with the class only in the visibility of one method I think this seems like a valid approach. |
Hi everyone, I'm sure @cmodijk was going to reply but I saw that passing by and thought it was an interesting suggestion - I didn't know PHP had the option to change visibility of trait methods when used, so... this would be a win-win situation I think. You don't always have to be DRY about everything, but in this case the implementation is not only accidentally the same, it is supposed to be the same. Thanks! |
@borNfreee @jdreesen @matthiasnoback Tnx for the discussion i never new this was possible with traits. I just merged this in the code bases tnx! |
No description provided.