This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Entity; | |
| use Doctrine\ORM\Mapping as ORM; | |
| use ApiPlatform\Core\Annotation\ApiResource; | |
| /** | |
| * Todo | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Entity; | |
| use Doctrine\ORM\Mapping as ORM; | |
| use ApiPlatform\Core\Annotation\ApiResource; | |
| /** | |
| * Todolist | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # config/packages/messenger.yaml | |
| framework: | |
| messenger: | |
| routing: | |
| 'App\Message\CreateArchiveMessage': amqp | |
| 'App\Message\SendEmailMessage': amqp_email |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| php bin/console messenger:consume-messages amqp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # config/packages/messenger.yaml | |
| framework: | |
| messenger: | |
| transports: | |
| amqp: "amqp://guest:guest@localhost:5672/%2f/messages" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Controller; | |
| use App\Message\CreateArchiveMessage; | |
| use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | |
| use Symfony\Component\Messenger\MessageBusInterface; | |
| class CreateArchiveController extends AbstractController | |
| { | |
| public function index(MessageBusInterface $bus) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\MessageHandler; | |
| use App\Message\CreateArchiveMessage; | |
| use Symfony\Component\Messenger\Handler\MessageHandlerInterface; | |
| class CreateArchiveHandler implements MessageHandlerInterface | |
| { | |
| // use constructor + autowiring to inject required services |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Message; | |
| class CreateArchiveMessage | |
| { | |
| public $userId; | |
| public function __construct(int $userId) | |
| { | |
| $this->userId = $userId; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Class HookMe | |
| * | |
| * Hooks wrapper class | |
| */ | |
| class HookMe | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace HelloApp; | |
| use Fwk\Core\Application; | |
| use Fwk\Core\Action\ProxyFactory; | |
| $app = new Application('HelloApp'); | |
| $app->register('Hello', ProxyFactory::factory(function($name = null) { | |
| return 'Hello '. ($name === null ? '!' : $name); | |
| })) |