Skip to content
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

[Theme] Make themes persistable & huuuge refactoring #4268

Merged
merged 24 commits into from
Feb 26, 2016

Conversation

pamil
Copy link
Contributor

@pamil pamil commented Feb 23, 2016

Q A
Bug fix? yes
New feature? yes
BC breaks? yes
Deprecations? no
Fixed tickets -
License MIT
Doc PR -
  • Allows to easily mock available themes in functional tests
  • No longer requires to clear cache if adding / removing / modifying theme

Unfortunately I had to do some refactoring, so the diff might be a little biased, but it's the last time as v0.17 is coming.

Based on #4287.

@aramalipoor
Copy link
Contributor

What about cache/templates.php? We need to clear/warm it up, to be able to actually use a theme, right?

Another question is about repository, who is responsible to fill it up with available themes? ThemeLocator or just like other resources (fixtures, controllers, etc.)?

@pamil
Copy link
Contributor Author

pamil commented Feb 23, 2016

Hello Aram!

In fact, currently only theme repository and translation files are set during container compilation. Templates can be loaded without being warmed up first (but it will be needed for production), translations sources are required to be added by compiler pass (for now), assets need to be dumped first (but can be also managed by some kind of a frontend controller in the future).

The themes will be synchronized by a command (I'm just writing it) that runs ThemeSychronizer included in this PR. There won't be any possibility to modify these entities in the backend, but we can use the built-in forms (like choice type) instead of our own. Moreover, we will be able to have valid relations based on foreign keys, not just strings as theme names.

@liverbool
Copy link
Contributor

why you breaks 2.8 (composer.json => "symfony/symfony": "^2.7.7, <2.8")?

@pamil
Copy link
Contributor Author

pamil commented Feb 23, 2016

@liverbool Symfony 2.8 caused some issues and I'd rather fix it in another PR as this is getting too big (also that requirement is not a part of this one).

@takeit
Copy link
Contributor

takeit commented Feb 24, 2016

Hi @pamil,

if I understood correctly, every time I will want to add a new theme I will need to run ThemeSychronizerCommand and you won't create any logic to upload the themes etc. right ? Don't you plan to add some events, like: sylius.theme.added, sylius.theme.removed when once dispatched (let's say from my app's controller), it will synchronize themes automatically?

@pamil pamil force-pushed the theme-bundle-persisting-themes branch from 9e23b0a to 5337d46 Compare February 24, 2016 12:56
@pamil pamil changed the title [WIP] [Theme] Make themes persistable [WIP] [Theme] Make themes persistable & huuuge refactoring Feb 24, 2016
@pamil pamil changed the title [WIP] [Theme] Make themes persistable & huuuge refactoring [Theme] Make themes persistable & huuuge refactoring Feb 24, 2016
@pamil pamil force-pushed the theme-bundle-persisting-themes branch from 5337d46 to 51115d0 Compare February 24, 2016 13:17
/**
* @author Kamil Kokot <kamil.kokot@lakion.com>
*/
final class SynchronizeCommand extends ContainerAwareCommand
Copy link
Member

Choose a reason for hiding this comment

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

Maybe ThemeSynchronizeCommand? as there is also ThemeDebugCommand etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm thinking about removing Theme from ThemeDebugCommand, as it only makes the class name longer and does not add much context.

Copy link
Member

Choose a reason for hiding this comment

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

Just keep consistent and it will be good 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, 👍

@pamil
Copy link
Contributor Author

pamil commented Feb 24, 2016

@takeit for now the only synchronizer job is to update persisted themes with the real state, the usage of events is a really good idea worth implementing, but for sure not in this PR :)

@@ -31,6 +31,7 @@
"doctrine/doctrine-cache-bundle": "~1.0",
"doctrine/doctrine-fixtures-bundle": "~2.2",
"doctrine/doctrine-migrations-bundle": "~1.0",
"doctrine/doctrine-module": "^1.0",
Copy link
Member

Choose a reason for hiding this comment

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

Requring this in Sylius sounds like an overkill, I guess I will learn what is needed in the rest of the PR but that's quite big deps to add.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll use another hydrator instead of the Doctrine one and it can be removed.

@gabiudrescu
Copy link
Contributor

me happy now 👯

@pamil pamil force-pushed the theme-bundle-persisting-themes branch from b3c3718 to 37d10df Compare February 25, 2016 15:26
@tristanbes
Copy link
Contributor

great job @pamil

pjedrzejewski pushed a commit that referenced this pull request Feb 26, 2016
[Theme] Make themes persistable & huuuge refactoring
@pjedrzejewski pjedrzejewski merged commit eeff333 into Sylius:master Feb 26, 2016
@pjedrzejewski
Copy link
Member

Great work @pamil! :D Hopefully this is last PR of this size before 1.0. :) 👍

@ahilles107
Copy link
Contributor

Do you know when https://github.com/Sylius/SyliusThemeBundle repo will be synchronized?

@pjedrzejewski
Copy link
Member

@ahilles107 Subtree split is running right now. :)

@ahilles107
Copy link
Contributor

In Readme link to docs is broken: http://sylius.org/en/latest/bundles/SyliusThemeBundle/index.html docs subdomain is missing.

@pamil pamil deleted the theme-bundle-persisting-themes branch February 26, 2016 14:36
@sstok
Copy link
Contributor

sstok commented Mar 6, 2016

So if you want to use the ThemeBundle you also need to configure the ResourceBundle?

@ahilles107
Copy link
Contributor

after this PR - yes

@sstok
Copy link
Contributor

sstok commented Mar 6, 2016

OK.. That actually makes me sad as it was a killer feature and now I need to configure the ResourceBundle only to use this. I can understand the integration, but please reconsider the coupling to the Sylius system and make it easier for others to use this.

@liverbool
Copy link
Contributor

👍 @sstok
But bigger issue for now (0.18.x-dev) i can't install resource-bundle case of "sylius/resource-bundle": "^0.17", in theme-bundle's composer.json.

@pamil
Copy link
Contributor Author

pamil commented Mar 7, 2016

@sstok It's quite unfortunate, I'm thinking about making ThemeBundle independent of ResourceBundle and themes persistance, but for now it's required.

@liverbool PR is coming, ^0.17 is equal to >=0.17,<0.18, gonna change it to accept 0.18 too

@pjedrzejewski
Copy link
Member

@pamil We should be consistent with other bundles and use 0.17.*, which is equal to what you mentioned above.

@pamil
Copy link
Contributor Author

pamil commented Mar 7, 2016

@liverbool should be all right now (there may be some delay because of a subtree split).

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.