-
Notifications
You must be signed in to change notification settings - Fork 93
Add Symfony 4 support #145
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
Thank you. I will make sure the tests are green later today. |
I was able to fix some of them, but I still have some weird fails. Also, StyleCI shows some fails not related to this PR. Should I fix them here? |
This PR is blocked by php-translation/symfony-storage#19 |
Finally, I was able to fix all the tests, but they pass only with php-translation/symfony-storage#19 patch |
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.
Thank you.
We need a legacy layer for the TranslationReader
Catalogue/CatalogueFetcher.php
Outdated
*/ | ||
public function __construct(TranslationLoader $loader) | ||
public function __construct(TranslationReader $reader) |
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 class does not exists in sf3.4
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.
Yeah, but I'm not sure what's the best way to inject wether translation.reader
or translation.loader
depends on Symfony version. Injecting the whole container probably is not an option because those services are private. Maybe Compiler Pass can help with it?
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.
Compiler pass would be preferable as that moves the calculation from runtime to compile time. 👍
Unfortunately TranslationLoader
does not have the TranslationReaderInterface
yet, so typehinting won't be possible right?
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.
@bocharsky-bw I've made a PR to your fork. Please have a look.
Resources/config/extractors.yml
Outdated
@@ -1,10 +1,12 @@ | |||
services: | |||
php_translation.extractor.php: | |||
public: true |
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.
Do these really have to be public?
One more blocker for this PR: php-translation/symfony-storage#22
|
Translation Loader or Reader and Definitions (BC SF3.3+)
@Nyholm finally this PR is done and ready for your review |
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.
Thank you
Catalogue/CatalogueFetcher.php
Outdated
use Translation\Bundle\Model\Configuration; | ||
use Translation\SymfonyStorage\LegacyTranslationLoader; | ||
use Translation\SymfonyStorage\TranslationLoader; |
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 interface does not exist anymore
Catalogue/CatalogueFetcher.php
Outdated
*/ | ||
public function __construct(TranslationLoader $loader) | ||
public function __construct($loader) |
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 renamed to "$reader"
Catalogue/CatalogueFetcher.php
Outdated
{ | ||
// Create a legacy loader which is a wrapper for TranslationReader | ||
if ($loader instanceof TranslationReader) { |
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.
if (!$loader instanceof TranslationReaderInterface)
Catalogue/CatalogueFetcher.php
Outdated
if ($loader instanceof TranslationReader) { | ||
$loader = new LegacyTranslationLoader($loader); | ||
} | ||
if (!$loader instanceof SymfonyTranslationLoader && !$loader instanceof TranslationLoader) { |
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 is not needed if you change the logic of the if
above
Catalogue/CatalogueWriter.php
Outdated
@@ -53,7 +53,7 @@ public function __construct( | |||
public function writeCatalogues(Configuration $config, array $catalogues) | |||
{ | |||
foreach ($catalogues as $catalogue) { | |||
$this->writer->writeTranslations( | |||
$this->writeTranslations( |
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.
We should use $this->writer->write()
|
||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
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.
Could you write a class comment that explains the purpose of this CompilerPass?
Resources/config/edit_in_place.yml
Outdated
@@ -14,6 +14,10 @@ services: | |||
class: Translation\Bundle\EditInPlace\Activator | |||
arguments: ['@session'] | |||
|
|||
test.php_translation.edit_in_place.activator: |
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.
Could we put these in a separate file?
class: Translation\Bundle\Catalogue\CatalogueFetcher | ||
arguments: ["@translation.loader"] | ||
arguments: ["@translation.loader_or_reader"] |
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.
Nice
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.
Yeah, thanks to @dkozickis for this idea and his help
@@ -13,26 +15,37 @@ services: | |||
arguments: ["@php_translation.catalogue_fetcher", "@php_translation.catalogue_writer", ~] | |||
|
|||
php_translation.catalogue_manager: | |||
public: true |
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.
Do the services need to be public?
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.
Yes, we call it from the container in WebUIController::showAction()
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.
We can inject it into controller instead, no?
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.
Yeah, we should But that is out of scope for 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.
IIRC, it won't work in 2.7, will it?
composer.json
Outdated
|
||
"php-translation/common": "^0.2.1", | ||
"php-translation/symfony-storage": "^0.3.2", | ||
"php-translation/symfony-storage": "^0.3.4", |
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.
Should be 0.4.0
@Nyholm All the requested changes are done! |
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.
Great. Just some minors
use Translation\Bundle\Model\Configuration; | ||
use Translation\SymfonyStorage\LegacyTranslationReader; | ||
use Translation\SymfonyStorage\TranslationLoader; |
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 interface does not exits anymore.
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.
What do you mean? Because I see it in master: https://github.com/php-translation/symfony-storage/blob/master/src/TranslationLoader.php and it is not even deprecated.
Command/ExtractCommand.php
Outdated
@@ -39,7 +39,7 @@ protected function configure() | |||
protected function execute(InputInterface $input, OutputInterface $output) | |||
{ | |||
$container = $this->getContainer(); | |||
$importer = $container->get('php_translation.importer'); | |||
$importer = $container->get('test.php_translation.importer'); |
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.
Hm... This is not perfect. Lets make php_translation.importer
public for now.
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.
Just fix this and I'm happy to merge
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.
Good catch! Sorry about this
You are correct. I meant o remove it.. Leave it like this for now.
Med vänliga hälsningar
Tobias Nyholm
… On 28 Dec 2017, at 15:05, Victor Bocharsky ***@***.*** ***@***.***>> wrote:
@bocharsky-bw commented on this pull request.
In Catalogue/CatalogueFetcher.php <#145 (comment)>:
> use Translation\Bundle\Model\Configuration;
+use Translation\SymfonyStorage\LegacyTranslationReader;
+use Translation\SymfonyStorage\TranslationLoader;
What do you mean? Because I see it in master: https://github.com/php-translation/symfony-storage/blob/master/src/TranslationLoader.php <https://github.com/php-translation/symfony-storage/blob/master/src/TranslationLoader.php> and it is not even deprecated.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#145 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABN1RpBWOTtf_HaMbYwRCbkPCgsVXw8kks5tE6AigaJpZM4Q_srX>.
<https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png> <https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png> <https://github.com/php-translation/symfony-bundle> <#145 (comment)>
|
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.
Awesome. Thanks!
No description provided.