向 Propel 和 Symfony 添加新表
我是 Propel 和 Symfony 的新手。事实上,Propel 比 Symfony 更重要。我正在处理现有的项目,我的任务是扩展它的数据库以获得一些新功能。我已经阅读了 Propel 和 Symfony 的手册,但我仍然不明白我是否已经有了新的结构,我应该在哪里放置新表的描述以及我应该如何重新生成它们以便有类。
我也使用旧的 symfony 1.2
感谢您的帮助。
I'm new to Propel and Symfony. Well actually more Propel, than Symfony. I'm working on already existing project and my task is to expand it database for some new features. I have read manual for Propel and Symfony, but I still don't understand if I already have new structure, where should I place the description of new tables and how should I regenerate them so there be classes.
Also I use old symfony 1.2
Thanks for help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据您使用的内容在 schema.yml 或 schema.xml 中添加表定义后,您可以使用以下命令重建模型、表单和过滤器:
symfony propel:build-model
symfony propel:build-forms
symfony propel:build-filters
这将创建基本模型和表单以及您可以在
lib/model 和 lib/form
然后,您可以使用以下命令从 schema.xml 或 schema.yml 中定义的模型创建 SQL 架构:
symfony propel:build-sql
- 这将在您的“data/sql”文件夹中创建一个文件。类似于 lib.model.schema.sql您可以在文本编辑器中打开该文件,然后只需复制新表并插入代码以在 phpmyadmin 中创建新表
Once you've added the table definitions in schema.yml or schema.xml depending on what you are using, you can then rebuild the models, forms and filters using:
symfony propel:build-model
symfony propel:build-forms
symfony propel:build-filters
This will create the base models and forms along with the skeleton forms that you can edit in
lib/model
andlib/form
You can then create the SQL schema from the models you've defined in the schema.xml or schema.yml using the following command:
symfony propel:build-sql
- this will create a file in your 'data/sql' folder. Something likelib.model.schema.sql
You can open that file in a text editor and then just copy the new tables and the insert the code to create the new table(s) in phpmyadmin
我真的认为你应该浏览 symfony 1.2 的教程并制作你自己的简单测试项目来熟悉 symfony。
这里有一些链接:
http://www.symfony-project.org/book/1_2/ 还有“模型层内部”
也很有帮助:
http://www.symfony-project.org/reference/1_2/en/
之后您可以提出更“可回答”的更具体的问题:)
I really think you should walk through a tutorial for symfony 1.2 and make your own simple test project to get familiar with symfony.
Here some links:
http://www.symfony-project.org/book/1_2/ there "Inside the model layer"
And also helpful:
http://www.symfony-project.org/reference/1_2/en/
After that you can ask more specific questions that are more "answerable" :)