> Symfony >

Course Overview

Conceptos b谩sicos de Symfony, Doctrine Relations y Warp Drive

Add dimensions to your app with database relations! Maybe you have many hive-minded aliens all related to one collective. Resistance to Doctrine relations is futile!

  • beginner
  • 657 students
  • EN/ES Captions
  • EN/ES Script
  • Certificate of Completion

Your Guides

About this course

What PHP libraries does this tutorial use?

// composer.json
{
    "require": {
        "php": ">=8.2",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "babdev/pagerfanta-bundle": "^4.5", // v4.5.0
        "doctrine/dbal": "^4", // 4.2.3
        "doctrine/doctrine-bundle": "^2.13", // 2.14.0
        "doctrine/doctrine-migrations-bundle": "^3.3", // 3.4.1
        "doctrine/orm": "^3.3", // 3.3.2
        "knplabs/knp-time-bundle": "^2.2", // v2.4.0
        "pagerfanta/doctrine-orm-adapter": "^4.7", // v4.7.1
        "php-cs-fixer/shim": "^3.46", // v3.73.1
        "phpdocumentor/reflection-docblock": "^5.3", // 5.6.1
        "phpstan/phpdoc-parser": "^2.0", // 2.1.0
        "stof/doctrine-extensions-bundle": "^1.12", // v1.13.0
        "symfony/asset": "7.2.*", // v7.2.0
        "symfony/asset-mapper": "7.2.*", // v7.2.3
        "symfony/console": "7.2.*", // v7.2.1
        "symfony/dotenv": "7.2.*", // v7.2.0
        "symfony/flex": "^2", // v2.5.0
        "symfony/framework-bundle": "7.2.*", // v7.2.4
        "symfony/http-client": "7.2.*", // v7.2.4
        "symfony/monolog-bundle": "^3.0", // v3.10.0
        "symfony/property-access": "7.2.*", // v7.2.3
        "symfony/property-info": "7.2.*", // v7.2.3
        "symfony/runtime": "7.2.*", // v7.2.3
        "symfony/serializer": "7.2.*", // v7.2.4
        "symfony/stimulus-bundle": "^2.13", // v2.23.0
        "symfony/twig-bundle": "7.2.*", // v7.2.0
        "symfony/ux-turbo": "^2.13", // v2.23.0
        "symfony/yaml": "7.2.*", // v7.2.3
        "symfonycasts/tailwind-bundle": "^0.9.0", // v0.9.0
        "twig/extra-bundle": "^2.12|^3.0", // v3.20.0
        "twig/twig": "^2.12|^3.0" // v3.20.0
    },
    "require-dev": {
        "doctrine/doctrine-fixtures-bundle": "^4.0", // 4.0.0
        "symfony/debug-bundle": "7.2.*", // v7.2.0
        "symfony/maker-bundle": "^1.52", // v1.62.1
        "symfony/stopwatch": "7.2.*", // v7.2.4
        "symfony/web-profiler-bundle": "7.2.*", // v7.2.4
        "zenstruck/foundry": "^2.2" // v2.3.8
    }
}

En la parte 1 del Tutorial de Doctrine hicimos cosas muy cool con Doctrine (nos lo hemos ganado 馃崷 imo). Creamos clases de entidad (隆gracias make:entity!), hicimos consultas personalizadas, migraciones, configuramos Docker 隆y mucho m谩s!

Pero... ignoramos una de las partes m谩s importantes de Doctrine: 隆las relaciones / asociaciones! Afortunadamente, crear relaciones de base de datos (ManyToOne, ManyToMany, etc.) nunca ha sido tan f谩cil, y Doctrine se encarga de una gran parte del trabajo por nosotros.

Despega en T menos... 隆empieza ya! 馃殌

  • Generando la famosa relaci贸n (asociaci贸n) ManyToOne
  • Estableciendo la relaci贸n (olvidate de las claves externas, 隆todo gira en torno a los objetos!)
  • Manejar relaciones en las fixtures con Foundry
  • El lado "inverso" de una relaci贸n OneToMany
  • Filtrar una colecci贸n de objetos relacionados con Criteria
  • orphanRemoval (隆no es tan cruel como parece!)
  • Consultas con JOIN
  • Resolver el problema N+1
  • Relaciones ManyToMany
  • ManyToMany con datos adicionales en la tabla de uni贸n

Tu misi贸n: abordar las relaciones Doctrine... sin estrellar la nave. 隆Lo tienes!

Next courses in the Symfony: The Fundamentals section of the Symfony Track!

10 Comments

Sort By
Login or Register to join the conversation
Eugeny avatar Eugeny 10 months ago

Thanks for the work done! For some reason there are no subtitles in parts 23 and 24.

Reply |

Hey @Eugeny

Could you check it again? I do see the subtitles for those chapters. Perhaps you get an error in the browser's console?

Cheers!

1 Reply |

Hello!
Today I see that there are subtitles, a couple of days ago there were none for some reason.

Reply |

Perhaps they weren't ready by that time. Thanks for informing us anyway ;)

Reply |

Today is a good day. The sun is shining, birds are singing and Ryan is back. Life is good :)

Reply |

Amen to that! Love that "Today is a good day." Gratitude for still being here 鉂わ笍

Reply |
Nick avatar Nick 1 year ago

Hey team symfonycasts
Really loving this course. Any ideas when this next part will be released? :)

Reply |

Hey @Nick!

I'm glad you're digging this course! Next part will be released in just the next few weeks!

Kevin

Reply |
Tac-Tacelosky avatar Tac-Tacelosky 1 year ago

I'm really hoping Doctrine ORM 3.4 comes out soon, so we can use Property Hooks. This makes lazy-loading MUCH easier, and will allow us to get rid of lots of boilerplate setters/getters.

Please consider including that functionality with this course. I know not everyone has PHP 8.4, but for those that do it'll be great to learn best practices for how to code. https://www.doctrine-project.org/blog/index.html has more about what's going to be in 3.4, and as they say "The lazy objects RFC in PHP 8.4 changes everything for the better in Doctrine ORM internally". I looks forward to learning the best practices for Doctrine Relations, especially with the context of API Platform and the Symfony Serializer.

Reply |

Hey @Tac-Tacelosky

Thank you for your input! I'll share it with the team

Cheers!

Reply |

Delete comment?

Share this comment

astronaut with balloons in space

"Houston: no signs of life"
Start the conversation!