Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DX] Add ability to disable AddClassesToCachePass compiler pass #17439

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

Closed
Strate opened this issue Jan 19, 2016 · 9 comments
Closed

[DX] Add ability to disable AddClassesToCachePass compiler pass #17439

Strate opened this issue Jan 19, 2016 · 9 comments
Labels
DX DX = Developer eXperience (anything that improves the experience of using Symfony) HttpKernel

Comments

@Strate
Copy link
Contributor

Strate commented Jan 19, 2016

There is no way to disable AddClassesToCachePass compiler pass.
It generates classes.map file, and then ClassCacheCacheWarmer always generated classes.php file.
So, if I do app/console cache:warmup for my dev environment I got a classes.php file always, wihtout exceptions. But I want to disable that, as it described in http://symfony.com/doc/current/cookbook/debugging.html (my IDE is not very happy with classes.php file)

The only one way to do that is to override buildContainer method in AppKernel.php file and remove line

$container->addCompilerPass(new AddClassesToCachePass($this));

There should be more convient way to do that.

@linaori
Copy link
Contributor

linaori commented Jan 19, 2016

Can't you simply exclude the var (or app/cache) directory from indexation? It shouldn't be a problem to an IDE to have this. I've personally never encountered a problem with this (or the above solutions provided).

@Strate
Copy link
Contributor Author

Strate commented Jan 19, 2016

I do not want to exclude app/cache directory from index - I want to have an indexed generated container/router/twig/etc files.
My ide (PhpStorm) can not exclude one file.

And one more thing, in cookbook entry http://symfony.com/doc/current/cookbook/debugging.html there is a section which describes how cache file could be renamed:

Some IDEs do not like the fact that some classes are stored in different locations. To avoid problems, you can either tell your IDE to ignore the PHP cache files, or you can change the extension used by Symfony for these files:
$kernel->loadClassCache('classes', '.php.cache');

This is definetely does not work now, because classes.php is hardcoded to ClassCacheCacheWarmer.

@linaori
Copy link
Contributor

linaori commented Jan 19, 2016

I'm using phpstorm and I've never had those issues before. Even if you mark it as excluded, you won't have issues with the symfony plugin.

@aivus
Copy link
Contributor

aivus commented Jan 19, 2016

@iltar what happens when you try to debug code, which in cache?
I think main reason in it.

@Strate
Copy link
Contributor Author

Strate commented Jan 19, 2016

I will try to developing with excluded cache folder, but inconsistent cookbook entry still an issue (and BC break for developing)

@xabbuh
Copy link
Member

xabbuh commented Jan 19, 2016

We have another inconsistency here. The loadClassCache() method from the Kernel class makes it possible to customise the cache prefix and extension of the generated cache file but the cache warmer has a hard coded classes.php filename. So in the worst case you would end up with two generated cache files.

@xabbuh
Copy link
Member

xabbuh commented Jan 19, 2016

We could introduce an option that would make it possible to disable the cache warmer (meaning the service definition wouldn't be loaded when the option was disabled).

By the way I created symfony/symfony-docs#6169 so that we remember to update the docs to reflect the new ClassCacheCacheWarmer.

@unexge
Copy link

unexge commented Jan 19, 2016

@Strate you can also mark the classes.php as Plain Text(with right clicking filename). and it will be ignored.

@javiereguiluz javiereguiluz added the DX DX = Developer eXperience (anything that improves the experience of using Symfony) label Jan 26, 2016
@xabbuh
Copy link
Member

xabbuh commented Feb 11, 2016

closing here as it this is more a matter of updating the documentation (see symfony/symfony-docs#6263 for the PR)

@xabbuh xabbuh closed this as completed Feb 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX DX = Developer eXperience (anything that improves the experience of using Symfony) HttpKernel
Projects
None yet
Development

No branches or pull requests

6 participants