-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Translation] Remove fluent interfaces #3315
[Translation] Remove fluent interfaces #3315
Conversation
CoderMaggie
commented
Sep 21, 2015
Q | A |
---|---|
Bug fix? | no |
New feature? | no |
BC breaks? | yes |
Deprecations? | no |
Fixed tickets | no |
License | MIT |
/** | ||
* @author Gonzalo Vilaseca <[email protected]> | ||
*/ | ||
class AbstractTranslation implements TranslationInterface | ||
{ | ||
/** | ||
* Locale. | ||
* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be added 😉
https://github.com/TheMadeleine/Sylius/blob/translation-fluent-interfaces/src/Sylius/Component/Translation/Model/AbstractTranslatable.php#L82 - this method should be on the interface |
@@ -44,10 +40,6 @@ public function getTranslatable() | |||
*/ | |||
public function setTranslatable(TranslatableInterface $translatable = null) | |||
{ | |||
if ($translatable === $this->translatable) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be reverted.
@@ -44,10 +40,6 @@ public function getTranslatable() | |||
*/ | |||
public function setTranslatable(TranslatableInterface $translatable = null) | |||
{ | |||
if ($translatable === $this->translatable) { | |||
return $this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above should be reverted, this line should be just return;
.
866f86a
to
4bbbe08
Compare
@michalmarcinkowski 👍 done. |
@@ -19,15 +19,11 @@ | |||
abstract class AbstractTranslatable implements TranslatableInterface | |||
{ | |||
/** | |||
* Translations. | |||
* | |||
* @var TranslationInterface[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collection|TranslationInterface[]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO putting Collection
here is a bad idea as we don't want to couple this interface with Doctrine Commons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it's already coupuled with them in __construct()
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, constructor in abstract class is not the thing I would expect :) Anyway, that should apply to TranslatableInterface
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pamil decoupling from Doctrine Common is a topic for a separate discussion and is not concern of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michalmarcinkowski Sure, that's why I want to prevent coupling at the moment :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's stick to current convention to avoid inconsistency and if we decide to decouple we will do it everywhere at once.
FWIW I'm working on a PR that gets rid of the abstract translation classes in favour of traits. |
@gonzalovilaseca that is great! If I will merge this PR will it make your rebase harder? |
@michalmarcinkowski Indeed ... but I might just copy this code to the trait, so go ahead, merge if you want and I'll find my way :-) |
[Translation] Remove fluent interfaces
Thank you Magda! 👍 |