feature #27168 [HttpKernel] Add Kernel::getAnnotatedClassesToCompile() (nicolas-grekas)

This PR was merged into the 4.1-dev branch.

Discussion
----------

[HttpKernel] Add Kernel::getAnnotatedClassesToCompile()

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Now that apps are usually bundle-less, we're missing a way to defined the classes to parse annotations for. Here is a PR fixing this by allowing ppl to define a new `getAnnotatedClassesToCompile()` on their kernel when needed.

Commits
-------

1d2a49aeb6 [HttpKernel] Add Kernel::getAnnotatedClassesToCompile()
This commit is contained in:
Fabien Potencier 2018-05-07 11:18:05 +02:00
commit df0296934d
2 changed files with 9 additions and 1 deletions

View File

@ -36,7 +36,7 @@ class AddAnnotatedClassesToCachePass implements CompilerPassInterface
*/
public function process(ContainerBuilder $container)
{
$annotatedClasses = array();
$annotatedClasses = $this->kernel->getAnnotatedClassesToCompile();
foreach ($container->getExtensions() as $extension) {
if ($extension instanceof Extension) {
$annotatedClasses = array_merge($annotatedClasses, $extension->getAnnotatedClassesToCompile());

View File

@ -391,6 +391,14 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
return 'UTF-8';
}
/**
* Gets the patterns defining the classes to parse and cache for annotations.
*/
public function getAnnotatedClassesToCompile(): array
{
return array();
}
/**
* Initializes bundles.
*