symfony2-Create submission form generate data process

Source: Internet
Author: User
First, "one-to-many" relationship

Table Shop (i)

Table Comment (Multi)

Save with SHOP_ID

Second, we first to manually generate shop and comment relationship

First case (can be generated)

Controller in

Tables can be generated, corresponding relationships

Table Shop

Table: Comment

Because the shop table in the comments, in fact, there is no field in the shop table, here is just a sign, to take comments convenient. such as $shop->getcomments (), and it is convenient to add comment.

Second case (cannot be generated)

What if I change the addcomments function?

Table correspondence cannot be generated

Table: Shop

Table: Comment

Why is it?

Because the comment table ID is not associated with the shop (that is, the ID of the shop is not stored in the real comment table)

Scenario Three: (Table relationships can be generated)

Table: Shop

Table: Comment

Add shop directly to the comment

Well, actually there's a "many-to-many" relationship?

How do I automatically generate a one-to-multiple relationship when I submit a table?

Say it next time.

The above describes the symfony2-to create a submission form to generate data, including the content, I hope to be interested in PHP tutorial friends helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.