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

[Notifier] Add notify helper in AbstractController #42418

Open
wants to merge 1 commit into
base: 5.4
Choose a base branch
from

Conversation

@ismail1432
Copy link
Contributor

@ismail1432 ismail1432 commented Aug 7, 2021

Q A
Branch? 5.4
Bug fix? no
New feature? yes
Deprecations? no
License MIT
Doc PR symfony/symfony-docs#...

As the Notifier become more popular and is not experimental anymore, I propose to add a shortcut in the AbstractController.
I would add tests if you're agree with this feature.

namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Notifier\Notification\Notification;

class SandboxController extends AbstractController
{
    /**
     * @Route("/onboarding", name="onboarding")
     */
     public function __invoke(): Response
     {
       $notification = new Notification('Welcome Sma <3', ['chat/slack']);
       $this->notify($notification);
       // stuff
     }
}
@ismail1432 ismail1432 changed the title add notify helper in abstractcontroller [Notifier] Add notify helper in AbstractController Aug 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants