为什么80%的码农都做不了架构师?>>>   

<?php/** This file is part of the Sylius package.** (c) Paweł Jędrzejewski** For the full copyright and license information, please view the LICENSE* file that was distributed with this source code.*/namespace Sylius\Bundle\CoreBundle\Checkout\Step;use Sylius\Bundle\FlowBundle\Process\Context\ProcessContextInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\SyliusCheckoutEvents;
use Symfony\Component\Form\FormInterface;/*** The addressing step of checkout.* User enters the shipping and shipping address.** @author Paweł Jędrzejewski <pawel@sylius.org>*/
class AddressingStep extends CheckoutStep
{/*** {@inheritdoc}*/public function displayAction(ProcessContextInterface $context){$order = $this->getCurrentCart();$this->dispatchCheckoutEvent(SyliusCheckoutEvents::ADDRESSING_INITIALIZE, $order);$form = $this->createCheckoutAddressingForm($order);return $this->renderStep($context, $order, $form);}/*** {@inheritdoc}*/public function forwardAction(ProcessContextInterface $context){$request = $this->getRequest();$order = $this->getCurrentCart();$this->dispatchCheckoutEvent(SyliusCheckoutEvents::ADDRESSING_INITIALIZE, $order);$form = $this->createCheckoutAddressingForm($order);if ($request->isMethod('POST') && $form->submit($request)->isValid()) {$this->dispatchCheckoutEvent(SyliusCheckoutEvents::ADDRESSING_PRE_COMPLETE, $order);$this->getManager()->persist($order);$this->getManager()->flush();$this->dispatchCheckoutEvent(SyliusCheckoutEvents::ADDRESSING_COMPLETE, $order);return $this->complete();}return $this->renderStep($context, $order, $form);}protected function renderStep(ProcessContextInterface $context, OrderInterface $order, FormInterface $form){$pre_data = $form->getData();  $address = $pre_data->getUser()->getShippingAddress();$pre_data->setShippingAddress( $address );$form->setData( $pre_data );return $this->render('SyliusWebBundle:Frontend/Checkout/Step:addressing.html.twig', array('order'   => $order,'form'    => $form->createView(),'context' => $context));}protected function createCheckoutAddressingForm(OrderInterface $order){return $this->createForm('sylius_checkout_addressing', $order);}
}

转载于:https://my.oschina.net/imot/blog/284705

Sylius不需要缓存使用默认地址相关推荐

  1. 将android studio产生的.gradle .android .androidStudio缓存从默认C盘移动到D盘

    启动AVD时:haxm device is not found 解决办法:下载haxm补丁包安装即可. why? android studio 在编译的时候会下载 builde.gradle 文件下 ...

  2. Exchange server 2003迁移到2010之升级默认地址簿及地址策略

    Exchange server 2003迁移到2010之升级默认地址簿及地址策略 1.     由于2003 的地址策略及地址簿的 语法使用的是LDAP筛选,而Exchange 2010 中使用的Op ...

  3. 谷粒商城---新增收货地址,设置默认地址实现

    今天实现了新增收货地址,设置默认地址的功能. 1.接收两个参数: @RequestMapping("/setdefualt") public R setdefualt(@Reque ...

  4. dj鲜生-34-存档-用户中心地址页重复查询默认地址的优化-利用自定义模型管理器的方法来实现

    复习模型类管理器 django-模型类管理器 - pyhui的python全栈技术博客 - CSDN博客 https://blog.csdn.net/ifubing/article/details/1 ...

  5. Python+Selenium练习篇13-设置浏览器下载文件默认地址

    本文介绍如何设置浏览器下载文件默认地址 设置Selenium自动化下载的浏览器默认地址 本人使用浏览器Chrome,python3.7 代码如下: # coding=utf-8 from seleni ...

  6. 宇视各类产品默认地址列表

    DMC拼接控制器默认的地址:192.168.1.65 IA8500-VD服务器默认的地址: 192.168.0.50 A8默认地址:192.168.0.100登录时需要加50080端口. DAE默认地 ...

  7. 服务器系统登录ilo,华为服务器ILO默认地址

    华为服务器ILO默认地址 内容精选 换一换 1.若希望以主席身份入会,enter_code必须传入主席密码.若希望以来宾身份入会,当会议要求来宾密码时,enter_code必须传入来宾密码,会议不要求 ...

  8. UNIAPP实战项目笔记43 购物车页面修改收货地址和修改默认地址

    UNIAPP实战项目笔记43 购物车页面修改收货地址和修改默认地址 实际案例图片 修改收货地址和修改默认地址页面布局和功能 具体内容图片自己替换哈,随便找了个图片的做示例 用到了vuex的状态机,具体 ...

  9. 安全设备默认地址账密总结

    防火墙 厂商 默认地址 用户名 密码 天融信 192.168.1.254 superman talent/talent@123 华为 192.168.0.1:8443 admin Huawei@123 ...

最新文章

  1. Java 用正则表达式 提取目录
  2. 程序员级别鉴定书(.NET面试问答集锦)
  3. centos7 tomcat 设置开机启动
  4. Ajax PHP 边学边练 之四 表单
  5. matlab fix函数_Matlab课后答案第四章
  6. spring mvc+spring + hibernate 整合(二)
  7. 如何写出优雅的异常处理
  8. troubleshoot之:分析OutOfMemoryError异常
  9. BI报表系统在银行业的应用
  10. 如何使用Tipard 3D Converter转换2D视频格式
  11. openstack相关资料集结
  12. 100多个微信小程序代码免费送
  13. Notepad3(高级文本编辑器)v5.19.815.2595版本更新啦
  14. 单机:Oracle 19C 数据库一键安装
  15. 北京市市级行政区域数据
  16. 2021苹果最新供应链名单公布
  17. vs2013 c++小代码运行完了不退出的方法
  18. 记一次笔记本win键失灵 不能用 windows 徽标键失灵
  19. DBCS(Double-Byte Character Set, 双位元组字元集)
  20. 计算机网络(三)数据链路层详解

热门文章

  1. 学习Kotlin(六)扩展与委托
  2. (二) LtRecyclerView v2.x (更多实用方法)
  3. wordpress外部调用到html_Spring 自调用事务失效,你是怎么解决的?
  4. 22个超详细的 JS 数组方法
  5. docker如何将运行中的容器保存为docker镜像?
  6. 2021-05-07 matlab中的addpath用法
  7. php ole word,介绍 · PHPword新版开发指南 · 看云
  8. 2018年4月java自考真题,全国2018年4月自考互联网数据库考试真题
  9. foreach 二维java_教你如何用for和foreach循环遍历java中的二维数组
  10. 【opencv】3.在一个opencv窗口中显示多个视频界面、画箭头、画掉头箭头