Flag of Ukraine
SymfonyCasts stands united with the people of Ukraine

Doctrine, Symfony 6 & the Database

2:28:56

What you'll be learning

// composer.json
{
    "require": {
        "php": ">=8.1",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "babdev/pagerfanta-bundle": "^3.7", // v3.7.0
        "doctrine/doctrine-bundle": "^2.7", // 2.7.0
        "doctrine/doctrine-migrations-bundle": "^3.2", // 3.2.2
        "doctrine/orm": "^2.12", // 2.12.3
        "knplabs/knp-time-bundle": "^1.18", // v1.19.0
        "pagerfanta/doctrine-orm-adapter": "^3.6", // v3.6.1
        "pagerfanta/twig": "^3.6", // v3.6.1
        "sensio/framework-extra-bundle": "^6.2", // v6.2.6
        "stof/doctrine-extensions-bundle": "^1.7", // v1.7.0
        "symfony/asset": "6.1.*", // v6.1.0
        "symfony/console": "6.1.*", // v6.1.2
        "symfony/dotenv": "6.1.*", // v6.1.0
        "symfony/flex": "^2", // v2.2.2
        "symfony/framework-bundle": "6.1.*", // v6.1.2
        "symfony/http-client": "6.1.*", // v6.1.2
        "symfony/monolog-bundle": "^3.0", // v3.8.0
        "symfony/proxy-manager-bridge": "6.1.*", // v6.1.0
        "symfony/runtime": "6.1.*", // v6.1.1
        "symfony/twig-bundle": "6.1.*", // v6.1.1
        "symfony/ux-turbo": "^2.0", // v2.3.0
        "symfony/webpack-encore-bundle": "^1.13", // v1.15.1
        "symfony/yaml": "6.1.*", // v6.1.2
        "twig/extra-bundle": "^2.12|^3.0", // v3.4.0
        "twig/twig": "^2.12|^3.0" // v3.4.1
    },
    "require-dev": {
        "doctrine/doctrine-fixtures-bundle": "^3.4", // 3.4.2
        "symfony/debug-bundle": "6.1.*", // v6.1.0
        "symfony/maker-bundle": "^1.41", // v1.44.0
        "symfony/stopwatch": "6.1.*", // v6.1.0
        "symfony/web-profiler-bundle": "6.1.*", // v6.1.2
        "zenstruck/foundry": "^1.21" // v1.21.0
    }
}

After the first two courses, we're going to turn the volume to 11! Yup, it's database time!

This tutorial is all about Doctrine: a powerful ORM that will allow us to talk to a database from inside our Symfony app. With the power of PHP 8 & tools inside Symfony, Doctrine is not only the most powerful ORM in PHP, it's also a joy to work with. You are going to love it!

  • Booting a database with Docker via the Flex recipe system
  • Database config
  • Creating (and updating) Entities with make:entity
  • Generating & using migrations
  • Inserting new data
  • Fetching & Querying for data
  • Doctrine Repositories
  • Custom queries and the query builder
  • Fixtures (Dummy data) using Foundry
  • Relationships & Associations

SELECT * FROM doctrine_knowledge.


Your Guides

Ryan Weaver

Buy Access

Join the Conversation?

4
Login or Register to join the conversation
Lionel-F Avatar
Lionel-F Avatar Lionel-F | posted 1 year ago

Hi guys, I got a general question about doctrine, where you flush/persist an entity ? In repository ? controller ? on a service ?

1 Reply

Hey Lionel F.

That's a good question. I usually manage entities through a service class, but sometimes I call flush in a controller for convenience. I think the answer is "it depends" on how complex is your process of creating new entities. If it's a straightforward process (call persist, then flush) doing it in the controller is acceptable

Cheers!

1 Reply
David_S Avatar

Hello,

I watched every video that is available at the moment. 7 videos are still at -comming soon-. Do you have any idea when this videos will be available?

Thank you and best regards
David

Reply

Hey David,

We're sorry for the delay, we're trying to release 1 new video a day, so I think the course will be completely released at the end of the next week. In short, our normal schedule is 1 video per day, stick to this pace.

Cheers!

2 Reply
Cat in space

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

userVoice