Doctrine Many to Many Relationship With Extra Fields | Columns. Learn Symfony Doctrine (2021).

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ม.ค. 2025

ความคิดเห็น • 37

  • @ricohumme4328
    @ricohumme4328 3 ปีที่แล้ว +2

    Hi Gary, thanks for this in-depth video. In the previous video leading to this one you mentioned compound foreign keys, which you forget to implement here. Current code would allow for user to have a membership to an already existing interest group at different points in time.
    Regarding your question at the beginning of the video, I'm currently keeping myself busy with testing the application, which is how I found your channel. Keep it up.

    • @GaryClarkeTech
      @GaryClarkeTech  3 ปีที่แล้ว +1

      I can't believe I forgot that! No-ones ever pointed it out before so thanks! I'll try to incorporate compound keys somewhere in the stuff I'm currently working on.

    • @aitorfernandez9958
      @aitorfernandez9958 3 ปีที่แล้ว +1

      @@GaryClarkeTech Thanks for the video, very interesting and insightful, really. But as Rico pointed out, it is quite important to have the foreign key constraints, since otherwise as he said we can't have unicity in the relations. Have you covered this anywhere? If so, (or if not), can you please point me in the right direction? Thank you!

    • @GaryClarkeTech
      @GaryClarkeTech  3 ปีที่แล้ว

      @@aitorfernandez9958 Hey Aitor, I've not covered compound keys using Doctrine anywhere yet. The only other person that I can imagine would cover this kind of thing is Ryan Weaver who does SymfonyCasts. You can check his stuff or ask him on twitter or something.

    • @aitorfernandez9958
      @aitorfernandez9958 3 ปีที่แล้ว

      @@GaryClarkeTech Hey Gary, thank you very much for your response. I did some research on my own after being left with the doubt, and actually implemented what I understand might be a valid approach to these compound primary keys.
      For anyone interested, I annotated every id i wanted to be part of the compound primary key with @ORM\Id. In my case I had two, a guid and an int, and Doctrine generated the constraints just fine, so I believe this would work for similar needs.

  • @15121Duncan
    @15121Duncan 2 ปีที่แล้ว

    This video was exaclty what i was looking for. It couldn't be better for me. Thank you so much!

  • @proFFessor90
    @proFFessor90 3 ปีที่แล้ว

    hi, it would be nice to see a video on creating doctrine custom types and dql methods (ilike for postgres)

  • @dmitryskvortsov6489
    @dmitryskvortsov6489 2 ปีที่แล้ว

    thank you for straightforward and easy explanation

  • @Michel2003g
    @Michel2003g ปีที่แล้ว +1

    maby you could make the many to one one to many inside the terminal?

  • @ЕвгенийБатулин-г9з
    @ЕвгенийБатулин-г9з 2 ปีที่แล้ว

    Garry! Thank you for the content. It's useful. If you are interested in my opinion, then for me, as a beginner, the interaction of the api with frontend is interesting. Thank you for your interest.

  • @artan1023
    @artan1023 3 ปีที่แล้ว +2

    Hi Gary, that’s is a great tutorial, would it be possible to add how to create symfony forms with many-to-many relationship with extra fields?

    • @GaryClarkeTech
      @GaryClarkeTech  3 ปีที่แล้ว +1

      Hi Artan..it could be something I consider in the future.
      Do you have a particular scenario in mind?

    • @OKYPC
      @OKYPC 3 ปีที่แล้ว +2

      please @@GaryClarkeTech maybe an basic stocks scenario ([ORDER (id, date, supplier)]-[ORDER-PRODUCT(id, order_id, product_id, quantity, price)]-[PRODUCT(id, name, category)])

    • @GaryClarkeTech
      @GaryClarkeTech  3 ปีที่แล้ว +1

      @@OKYPC Thanks..let me think about it 👍

    • @klesk44
      @klesk44 ปีที่แล้ว +2

      @@GaryClarkeTech hello, 2 years later, does this is out somewhere ? Thanks

  • @MrWilde
    @MrWilde 3 ปีที่แล้ว +1

    Hey Gary, would love to see more testing with projects

    • @GaryClarkeTech
      @GaryClarkeTech  3 ปีที่แล้ว

      Great Robert. Lot of testing the the eCommerce project I'm doing.

  • @abdelilahaassou6333
    @abdelilahaassou6333 3 ปีที่แล้ว

    Thank you, Gary, for this great videos. I would like to see more about APIs and projects (back+front).

  • @mairahs16
    @mairahs16 2 ปีที่แล้ว

    Hi Gary 😊 very useful..thank you

  • @lazarvukosavljevic9575
    @lazarvukosavljevic9575 ปีที่แล้ว

    Your videos are awesome, helped alot, thank you alot, It would be nice to increase mic for 20%

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว

      Thank you 🙏Mic is a lot better in my later recordings...this is quite an old one

  • @杨志-n6z
    @杨志-n6z ปีที่แล้ว +1

    add MemmberShip entity is the only way?

    • @GaryClarkeTech
      @GaryClarkeTech  ปีที่แล้ว

      It's the only way I've ever done it using Doctrine. There might be another way but I've never explored it. ChatGPT might be able to suggest an alternative.

  • @RomanA-p6h
    @RomanA-p6h 2 ปีที่แล้ว

    You just have the best Symfony channel !!!
    You do not take students?

    • @GaryClarkeTech
      @GaryClarkeTech  2 ปีที่แล้ว

      Thanks a lot! The videos take up all of my time so there's not enough time for individual students atm

  • @johnfawcett3503
    @johnfawcett3503 3 ปีที่แล้ว

    Hi Gary, I found this and the other videos very informative - thank you very much. Is there a chance you could in future put together a video covering Symfony Forms and how you would implement the many to many relationship there? An example would be having a master (say for example user) and have the ability to select or tick items in a selectbox (example training courses completed) and have the join entity / table reflect the selected items? Would I have to resort to using Javascript to handle it or could it be done using forms?

    • @GaryClarkeTech
      @GaryClarkeTech  3 ปีที่แล้ว

      Thanks John..I'm glad you find them helpful.
      I've not tried your scenario using the Symfony Form component before but when I've needed inputs which relate to multiple entities of the same type, I've been able to use the name attribute like this name="course[1]" where the 1 would be a dynamically rendered id. I've done this with test inputs a few times but can't recall doing with checks .. so might be a bit more fiddly but it can be done without js. Check Matt's tutorial for ideas
      mattstauffer.com/blog/a-little-trick-for-grouping-fields-in-an-html-form/

    • @johnfawcett3503
      @johnfawcett3503 3 ปีที่แล้ว +1

      @@GaryClarkeTech Thanks Gary, that's given me something to look into - will take a look further and see what I can come up with! Cheers John

  • @tianadede349
    @tianadede349 3 ปีที่แล้ว

    thanks for videos ( ca you do creating Bundles ) ?

    • @GaryClarkeTech
      @GaryClarkeTech  3 ปีที่แล้ว

      Maybe some time in the future. Thanks for the suggestion 👍