Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[FrameworkBundle] Added flex-compatible default implementations forMicroKernelTrait::registerBundles() andgetProjectDir()#34872

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:masterfromnicolas-grekas:µk
Dec 13, 2019

The head ref may contain hidden characters:"\u00B5k"

Dismiss

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedDec 7, 2019
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
Deprecations?no
Tickets-
LicenseMIT
Doc PR-

I think it's safe now to migrate some flex-based defaults from the recipe to the bundle.
No BC break here as all existing kernels already redefine this method.

onEXHovia, ihmels, ro0NL, and sstok reacted with thumbs up emoji
@nicolas-grekasnicolas-grekas added this to thenext milestoneDec 7, 2019
@nicolas-grekasnicolas-grekas changed the title[FrameworkBundle] Add MicroKernelTrait::registerBundles() implementation[FrameworkBundle] Added flex-based default implementation forMicroKernelTrait::registerBundles()Dec 7, 2019
@nicolas-grekasnicolas-grekas changed the title[FrameworkBundle] Added flex-based default implementation forMicroKernelTrait::registerBundles()[FrameworkBundle] Added flex-compatible default implementations forMicroKernelTrait::registerBundles() andgetProjectDir()Dec 8, 2019
@nicolas-grekasnicolas-grekas changed the title[FrameworkBundle] Added flex-compatible default implementations forMicroKernelTrait::registerBundles() andgetProjectDir()[FrameworkBundle] Added flex-compatible default implementation forMicroKernelTrait::registerBundles()Dec 9, 2019
@nicolas-grekasnicolas-grekas changed the title[FrameworkBundle] Added flex-compatible default implementation forMicroKernelTrait::registerBundles()[FrameworkBundle] Added flex-compatible default implementations forMicroKernelTrait::registerBundles() andgetProjectDir()Dec 9, 2019
}

$container->fileExists($this->getProjectDir().'/config/bundles.php');
$container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID <70400 || !ini_get('opcache.preload'));
Copy link
Member

Choose a reason for hiding this comment

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

isn't it an issue to change the cache-warmup behavior based on thepreload config, while you need to warmup your cache before being able to confire the preloading ?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This will remove inline "require" statements that are generated currently.
They are not needed anymore when preloading is used.

Copy link
Member

Choose a reason for hiding this comment

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

my issue is that runningcache:warmup then adding thepreload file in the php.ini and then runningcache:warmup again will produce a different cache.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

yes ok, I wouldn't care much :)

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

OK, removed :)

Copy link
MemberAuthor

@nicolas-grekasnicolas-grekasDec 11, 2019
edited
Loading

Choose a reason for hiding this comment

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

Ppl that care about the extra perf this would provide would better enable preloading instead on PHP 7.4.
Removing will prevent issues with CLI vs FPM with different config for opcache.preload.

…MicroKernelTrait::registerBundles()` and `getProjectDir()`
nicolas-grekas added a commit that referenced this pull requestDec 13, 2019
…entations for `MicroKernelTrait::registerBundles()` and `getProjectDir()` (nicolas-grekas)This PR was merged into the 5.1-dev branch.Discussion----------[FrameworkBundle] Added flex-compatible default implementations for `MicroKernelTrait::registerBundles()` and `getProjectDir()`| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Tickets       | -| License       | MIT| Doc PR        | -I think it's safe now to migrate some flex-based defaults from the recipe to the bundle.No BC break here as all existing kernels already redefine this method.Commits-------a689807 [FrameworkBundle] Added flex-compatible default implementations for `MicroKernelTrait::registerBundles()` and `getProjectDir()`
@nicolas-grekasnicolas-grekas merged commita689807 intosymfony:masterDec 13, 2019
nicolas-grekas added a commit that referenced this pull requestDec 13, 2019
…in MicroKernelTrait::configureContainer() (nicolas-grekas)This PR was merged into the 5.1-dev branch.Discussion----------[FrameworkBundle] Allow using a ContainerConfigurator in MicroKernelTrait::configureContainer()| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Tickets       | -| License       | MIT| Doc PR        | -This PR is a continuation of#32937 (it reverts some parts of it that are not needed anymore). It builds on#34872 for now.This PR allows using the PHP-DSL natively in our `Kernel::configureContainer()` methods.It allows the same in our `Kernel::configureRoutes()` methods.Both signatures are handled gracefully with no deprecations to let existing code in peace:- `protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader);`- `protected function configureContainer(ContainerConfigurator $c);` (a loader is always passed as 2nd arg to ease FC)Same for routes:- `protected function configureRoutes(RoutingConfigurator $routes);`- `protected function configureRoutes(RouteCollectionBuilder $routes);` (this one is deprecated because `RouteCollectionBuilder` is deprecated)Here is my working `src/Kernel.php` after this change:```phpclass Kernel extends BaseKernel{    use MicroKernelTrait;    protected function configureContainer(ContainerConfigurator $container): void    {        $container->import('../config/{packages}/*.yaml');        $container->import('../config/{packages}/'.$this->environment.'/*.yaml');        $container->import('../config/services.yaml');        $container->import('../config/{services}_'.$this->environment.'.yaml');    }    protected function configureRoutes(RoutingConfigurator $routes): void    {        $routes->import('../config/{routes}/'.$this->environment.'/*.yaml');        $routes->import('../config/{routes}/*.yaml');        $routes->import('../config/routes.yaml');    }}```Commits-------cf45eec [FrameworkBundle] Allow using a ContainerConfigurator in MicroKernelTrait::configureContainer()
nicolas-grekas added a commit that referenced this pull requestDec 17, 2019
… of controllers and service factories (nicolas-grekas)This PR was merged into the 5.1-dev branch.Discussion----------[FrameworkBundle] Allow using the kernel as a registry of controllers and service factories| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Tickets       |Fix#28992,fix#29997| License       | MIT| Doc PR        | -This PR builds on#34873 and#34872 and allows using the `Kernel` as a registry of autowired controllers and service factories. The `ContainerConfigurator` passed to `configureContainer()` defaults to declaring autowired and autoconfigured services.TL;DR: Silex is back but in a much more powerful way \o/Here is a Kernel that just works and displays `Hello App\Foo` on the `/` route:```phpclass Kernel extends BaseKernel{    use MicroKernelTrait;    protected function configureContainer(ContainerConfigurator $container): void    {        $container->services()            ->load('App\\', '../src')            ->set(Foo::class)                ->factory([$this, 'createFoo']);    }    public function createFoo(Bar $bar)    {        return new Foo($bar);    }    protected function configureRoutes(RoutingConfigurator $routes): void    {        $routes->add('home', '/')->controller([$this, 'helloAction']);    }    public function helloAction(Foo $foo)    {        return new Response('Hello '.get_class($foo));    }}```Commits-------9c9b99c [FrameworkBundle] Allow using the kernel as a registry of controllers and service factories
@nicolas-grekasnicolas-grekas modified the milestones:next,5.1May 4, 2020
@fabpotfabpot mentioned this pull requestMay 5, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

@weaverryanweaverryanweaverryan approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

5.1

Development

Successfully merging this pull request may close these issues.

4 participants

@nicolas-grekas@weaverryan@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp