我构建的大多数东西都需要有人选择一个国家/州/城市。
我想向 symfony 添加表单类型,以轻松添加国家/州/城市的链接选择字段。因此,用户会选择一个国家/地区,然后它会过滤这些州;选择一个州,它会过滤城市。
这是一件非常常见的事情,所以我一直在尝试找到一个已经实现这种表单类型的包,但我还没有找到任何东西。我找到了很多关于如何从头开始创建此功能的建议。
如果没有必要的话,我讨厌重新发明轮子,所以如果已经编写并测试了一些东西,我肯定更愿意至少从它开始。
希望这能帮助其他人寻找同样的东西。
感谢您的帮助!
最佳答案
看看这个 bundle :https://github.com/Sylius/SyliusAddressingBundle
Addresses management is a common task for almost every ecommerce application. This bundle, with minimal configuration, provides you sensible models and architecture for addresses, countries and provinces.
It's fully customizable - you can easily add custom fields to your address entity, or split it into several models to handle different address types. Includes a set of forms that will be sufficient for most popular actions.
关于php - 是否有适用于国家/地区/城市选择器的 Symfony2 表单扩展?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25211023/