webcustoms / enlight-symfony-wrapper
允许在 Shopware 插件中使用 Symfony 3 控制器。
v1.0
2019-01-30 13:59 UTC
Requires
- symfony/routing: ~3.4.15
This package is not auto-updated.
Last update: 2024-09-22 09:54:14 UTC
README
它做什么?
它允许您在 Shopware 插件中使用 Symfony 框架提供的 Route 注解标签。
安装
composer require webcustoms/enlight-symfony-wrapper
示例用法
查看 example 目录中的示例。
如何
... 实现 CSRFWhitelistAware?
只需在类定义中实现它,我们就会自动捕获。
... 生成我的操作的 URL?
$this->container->get('router')->assemble([ 'module' => 'Your\Name\Space', // optional if it's the current one 'controller' => 'YourClassName', // optional if it's the current one 'action' => 'yourMethodName' ]);
或者
$this->container->get('router')->assemble([ // You can also set 'route' directly, either the auto-generated // name from Symfony, or the "name" attribute you set manually // for your route. 'route' => 'your_name_space.your_class_name.your_method_name' ]);
... 在 preDispatch 或 postDispatch 上执行某些操作?
通过订阅 Symfony 中描述的事件,如文章如何设置前后过滤器。
以下 Shopware 类似的事件按顺序通知
Enlight_Controller_Action_PreDispatchEnlight_Controller_Action_PreDispatch_Backend(或_Api、_Frontend、_Widgets,具体取决于 URL)Enlight_Controller_Action_PreDispatch_MyNameSpace\MyController(这不会很有帮助)Enlight_Controller_Action_Backend_WebcustomsEnlightSymfonyWrapperComponentsControllerWrapper_MyMethodNamePreDispatch_mynamespace_mycontroller_myactionPreDispatch_MyNameSpace\MyController::MyActionDispatch_mynamespace_mycontroller_myaction(notifyUntil)Dispatch_MyNameSpace\MyController::MyAction(notifyUntil)PostDispatchSecure_mynamespace_mycontroller_myactionPostDispatchSecure_MyNameSpace\MyController::MyActionPostDispatch_mynamespace_mycontroller_myactionPostDispatch_MyNameSpace\MyController::MyActionEnlight_Controller_Action_PostDispatchSecure_MyNameSpace\MyControllerEnlight_Controller_Action_PostDispatchSecure_Backend(或_Api、_Frontend、_Widgets,具体取决于 URL)Enlight_Controller_Action_PostDispatchSecureEnlight_Controller_Action_PostDispatch_MyNameSpace\MyControllerEnlight_Controller_Action_PostDispatchS_Backend(或_Api、_Frontend、_Widgets,具体取决于 URL)Enlight_Controller_Action_PostDispatch