Doctrine ORM Query Builder - Full PHP 8 Tutorial

  Рет қаралды 18,069

Program With Gio

Program With Gio

Күн бұрын

In this lesson, we learn more about the Doctrine Query Language (DQL), the ORM's Query Builder & events.
SOME OF THE WAYS YOU CAN SUPPORT THE CHANNEL
👍 Smash the like button
🤝 Subscribe to the channel & turn the notifications on
💬 Post comments, any feedback is greatly appreciated
⭐ Become a Patreon: / programwithgio
THANK YOU!
🛠️ TOOLS & SERVICES I USE
Digital Ocean Hosting - Get 100$ credit - m.do.co/c/38b9...
Domains on Namecheap - namecheap.pxf....
Envato Elements - 1.envato.marke...
Adobe Photoshop & Premiere - clk.tradedoubl...
COURSE PLAYLIST
• Learn PHP The Right Wa...
RESOURCES
Source Repo - github.com/gge...
Query Builder - www.doctrine-p...
DQL - www.doctrine-p...
Events - www.doctrine-p...
Native SQL - www.doctrine-p...
** Affiliate Disclaimer: Some of the above links may be affiliate links, which may generate me a sales commission at no additional cost to you.

Пікірлер: 89
@z3ko
@z3ko 2 жыл бұрын
Full Doctrine tutorial would be great :) Thank you for great lessons!
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Noted. Thank you
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
​@@Hemant_Maurya don't forget I do this as a hobby & record on my free time. Unfortunately I don't have a lot of free time and still need to finish this PHP series which has been going on for almost 2 years now with over 100 videos. I did not promise I would make full doctrine tutorial right now. It's in my notes & queue so at some point I might get to it, I might not, depending on which direction I decide to go with the content.
@d33pFaiL
@d33pFaiL Жыл бұрын
+1
@aweklin
@aweklin Жыл бұрын
+1
@aweklin
@aweklin Жыл бұрын
Your channel should be the goto for learning PHP and I love the fact that you tagged it "THE RIGHT WAY". You actually did justified that. Thanks a bunch.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you so much 🙌💙
@cpanagoulias
@cpanagoulias 2 жыл бұрын
Definitely would love to see a more detailed tutorial on Doctrine!
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Noted. Thank you
@alirezaeftekhari8358
@alirezaeftekhari8358 2 жыл бұрын
Your lessons about doctrine are outstanding. It would be awesome if we had a full doctrine tutorial. 😍
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you, happy to hear that 🙌 💙
@nicoaravlad974
@nicoaravlad974 11 ай бұрын
Great tutorial, congrats for doing this content in such a nice way! A full Doctrine tutorial will be welcomed!
@ProgramWithGio
@ProgramWithGio 11 ай бұрын
Thank you 🙏
@mahmoudhazem1300
@mahmoudhazem1300 2 жыл бұрын
Your lessons r really awesome 🥰 It would be great to make a series about doctrine😍
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Noted, thank you
@constantinci
@constantinci 2 жыл бұрын
This time I am a bit late with my appreciation, but no matter what don't stop doing your great work.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you 💙💙
@truthteachers
@truthteachers Жыл бұрын
Fantastic bro. You are good teacher. We learnt a lot. After your videos on ORM so far, we got the following takeaways - (1) The script get code-overloaded which means the app may also face the same fate (2) overloaded code dependencies just too get a simple DB insert and query (compared to the PDO method done earlier). I agree that ORM is great implementation of OOP usage but a very very messy one. Perhaps these provide the necessary justifications to stick to pre-built frameworks like Codeigniter and Laravel or stick to basics of PHP. Thank you so much for the well done course.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You're welcome & thank you. Yea Doctrine ORM is not a simple thing I agree, Laravel's eloquent is much easier to work with, however Doctrine ORM (which Symfony uses) can be more flexible/performant. There are pros & cons to both Active Record & Data Mapper patterns, Doctrine is Data Mapper while Eloquent is Active Record. Vanilla PHP with PDO is a lot of times enough for simple apps & ORM may be overkill I agree.
@bakosyy
@bakosyy Жыл бұрын
@@ProgramWithGio Do you recommend using doctrine/dbal instead of PDO?
@derzskyi1
@derzskyi1 2 жыл бұрын
You explain very well. Even though I know almost everything, I still watch videos with ORM. I'm very interested to see a comprehensive Doctrine course!
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Glad to hear that, thank you
@lplusearn
@lplusearn Жыл бұрын
I followed along the tutorial there is a lot to learn, so may concepts here, but in my opinion I request the Doctrine Full Course🤣🤣 Doctrine has a very high-level data-abstraction it could be better with a comprehensive course on it, reading docs doesn't cook for everyone.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Noted, thank you
@baptistedara8026
@baptistedara8026 2 жыл бұрын
RT Full Doctrine tutorial would be great :) Thank you for great lessons!
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
👍👍
@baptistedara8026
@baptistedara8026 2 жыл бұрын
@@ProgramWithGio thank for all you done
@baptistedara8026
@baptistedara8026 2 жыл бұрын
you teach me even what my teachers at school couldn't explain well
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@@baptistedara8026 you're welcome, happy to hear that 🙌💙
@skv1991
@skv1991 2 жыл бұрын
Awesome video! 🤩 Thank you!
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
You’re welcome 😊
@supercoolninja
@supercoolninja 2 жыл бұрын
You explain it verry well, thanks a lot keep it up.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
No problem, thank you 🙌
@sujalkhatiwada2267
@sujalkhatiwada2267 Жыл бұрын
Of course sir, we want a full Doctrine playlist, it would really help, we don't have many courses about doctrine on the internet for free in easy to understand way, that's way, even if there are others, they are outdated stuff. So, yes we need a Doctrine course from you.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thanks for the input
@GuilhermeSouza-ko9ri
@GuilhermeSouza-ko9ri 2 жыл бұрын
Quality content! Thanks a lot!
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you 🙌
@Beowolf7308
@Beowolf7308 Жыл бұрын
Great tutorial, keep up the good work. A full Doctrine tutorial would be great! Also one question where is the file containing the data to populate the tables?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you. We dont have a file populating tables with data
@chrisodillman3355
@chrisodillman3355 Жыл бұрын
That was really cool!!! Thank you
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Glad you liked it
@shashithawitharana2295
@shashithawitharana2295 2 жыл бұрын
Thank you, sir. this is very helpful...
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
You are welcome
@invgreat5608
@invgreat5608 Жыл бұрын
❤❤❤ super video, thank you ❤
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Glad you liked it, thank you
@mwaas
@mwaas Жыл бұрын
another super content 100/100
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you 🙌
@shivdayalshekhawat4941
@shivdayalshekhawat4941 2 жыл бұрын
Please create full tutorial of doctrine. I love to checkout your videos thanks very much
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Will try, thanks for the suggestion
@Zubbee
@Zubbee 2 жыл бұрын
I would love to see more on doctrine for sure. It seems like a very vast library. I'm already lining up the orm links to the documentations to read but I'll still move on while doing so. But if I understand correctly, is ORM like a more advanced option to DBAL? I mean can I learn and work with ORM and not need to familiarize myself with DBAL? You did say that DBAL is an abstraction layer but I'm not totally clear on how they relate in practice. Maybe I need to go back and watch the DBAL lesson again. Thanks a lot Gio. These contents are precious.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
DBAL is abstraction layer, gives you basic query builder for example. ORM let's you map your database tables & relationships to entities so that you can use entity objects instead of building raw queries and then hydrating some objects yourself. If you like working with objects and entities then ORM is what you need.
@Zubbee
@Zubbee 2 жыл бұрын
@@ProgramWithGio oh, I understand it more now. Thanks Gio
@pusikurac986
@pusikurac986 2 жыл бұрын
great content as always. pretty much every topic covered in your tutorials is covered thoroughly, except for the callbacks tutorial. i think callback topic is not explained in your manner, i wish you could do a bit longer and more in depth video on callbacks, when to use them, how to call them when passed as arguments, best practices etc...
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you & thanks for the suggestion, I'll make a note of that. Do you mean the callbacks/closures in general or the Doctrine related lifecycle callbacks?
@pusikurac986
@pusikurac986 2 жыл бұрын
@@ProgramWithGio in general
@aliakbarmohajeruni
@aliakbarmohajeruni 9 ай бұрын
Thank you❤
@ProgramWithGio
@ProgramWithGio 8 ай бұрын
You're welcome
@Paltibenlaish
@Paltibenlaish Жыл бұрын
what about joins with and condition or subqueries inside the join?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You can do joins & for complex queries you can use expressions
2 жыл бұрын
Thx Gio :) can you create a Video with Fibers?
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Maybe in future, I don't work with async PHP but its something I want to learn myself, so when I do I'll make sure to make videos on it.
@kirankrishnan8553
@kirankrishnan8553 2 жыл бұрын
Thanks. Would love to see detailed videos on mysql just like how you did for php
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you
@objectivesolutions1137
@objectivesolutions1137 2 жыл бұрын
Thank you.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
You're welcome!
@walayat_khan
@walayat_khan 2 жыл бұрын
Thanks for your efforts. You have give us new start and a reason to love php. All videos are great and we are waiting for the security portion although you have explained sql injection but I am waiting for other types of security. Will you make laravel series or mention any already made series on KZbin or other platform. Much appreciated.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you, I don't think I'll be doing Laravel from scratch series since there are already some great content around it available like Laracasts free Laravel course. I'll be doing more advanced things with Laravel after the PHP series. Maybe in future I'll make full Laravel series as well, we'll see
@truthteachers
@truthteachers Жыл бұрын
Oh dear, did the script doctrine-orm-example.php from the previous lesson got completely changed?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Yes, that file isnt in the source repo either because its just an example file which is different for this lesson. It just configures & instantiates the entity manager as the start, nothing new. Its there to just demonstrate some of the examples.
@truthteachers
@truthteachers Жыл бұрын
@@ProgramWithGio Its ok. Its just that it delays my learning to try and understand the new code from top to bottom. Anyway, i created a new script and entered all the code line by line and understand. Tq,
@ProgramWithGio
@ProgramWithGio Жыл бұрын
@@truthteachers it's better that way to be honest, creating your own example file will help you digest those lines better
@md.abdullahalmamunroni1833
@md.abdullahalmamunroni1833 2 жыл бұрын
Please make a complete tutorial on Guzzle Https
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you for the suggestion
@MohamedSayedMohamedZaki
@MohamedSayedMohamedZaki 8 ай бұрын
We need your support for full doctrine course cover
@ProgramWithGio
@ProgramWithGio 7 ай бұрын
Maybe in future
@chadcglk7951
@chadcglk7951 2 жыл бұрын
Best PHP tutorial, please make a vanilla php app course paid/youtube
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you. This is the vanilla PHP series/course 🙂. There is a link to the playlist in the description
@chadcglk7951
@chadcglk7951 2 жыл бұрын
@@ProgramWithGio Thanks Gio, have seen the whole series, what I meant was something like utility/ forum/ social media clone from scratch without framework. There are many courses out there but haven't seen any course/tutorial with your level of expertise, organized & ability to teach. Would like to see something built from scratch. Keep up the good work.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@@chadcglk7951 got it. Thanks for the suggestion. We will work on a project at the end of the series, it won't use frameworks, will use packages though like Doctrine possibly & some Symfony components. Still ironing out the details
@benderbg
@benderbg 4 ай бұрын
Events part at the end should've been explained at the end of last lesson since the code was no longer the same in doctrine_orm_example.php file and that file is also not available on the github repo. Otherwise great lesson once again.
@ProgramWithGio
@ProgramWithGio 4 ай бұрын
Thank you
@rxxt-sh1vj
@rxxt-sh1vj 2 жыл бұрын
What about building an ORM from scratch?...:D and at last a PHP framework from scratch like Zura Tried..:D that will be super interesting
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Nah, I don't like to reinvent the wheel. Building ORM or framework might be useful for education to teach how it works but it's more useful in my opinion to teach how actual popular ORMs and frameworks work which will be more practical.
@mwaas
@mwaas Жыл бұрын
It would be great to be a CRUD project from zero using Doctrine
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Yup, we are working on a project called Expennies after this section
@mwaas
@mwaas Жыл бұрын
@@ProgramWithGio Thanks so much, I owe you so much
@ProgramWithGio
@ProgramWithGio Жыл бұрын
@@mwaas you're welcome, you don't owe me anything, cheers 🙌
@expresscoding3525
@expresscoding3525 Жыл бұрын
Sir, Thee below query is giving error at 14:25 : $query = $queryBuilder ->select('i', 'it') ->from('\App\Entity\Invoice', 'i') ->join('i.items', 'it') ->where( $queryBuilder->expr()->andX( $queryBuilder->expr()->gt('i.amount', ':amount'), $queryBuilder->expr()->orX( $queryBuilder->expr()->eq('i.status', ':status'), $queryBuilder->expr()->gte('i.createdAt', ':date') ) ) ) ->setParameter('amount', 100) ->setParameter('status', 1) ->setParameter('date', '2023-10-04 20:20:30') ->orderBy('i.createdAt', 'desc') ->getQuery(); Fatal error: Uncaught Doctrine\ORM\Query\QueryException: SELECT i, it FROM App\Entity\Invoice i INNER JOIN i.items it, App\Entity\Invoice i INNER JOIN i.items it WHERE i.amount > :amount AND (i.status = :status OR i.createdAt >= :date) ORDER BY i.createdAt DESC in /Applications/XAMPP/xamppfiles/htdocs/doctrine_1/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php:23 Stack trace: #0
@ProgramWithGio
@ProgramWithGio Жыл бұрын
On first glance that looks correct, you need to debug it to see why it doesnt work for you. Try to get the DQL and dump it out & see what is the generated query. var_dump($queryBuilder->getDQL())
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 30 МЛН
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
PHP Enums With Practical Examples - Full PHP 8 Tutorial
28:13
Program With Gio
Рет қаралды 27 М.
Raw SQL, SQL Query Builder, or ORM?
16:19
ArjanCodes
Рет қаралды 108 М.
Doctrine ORM: Entity, Identity Map, Unit Of Work
47:29
R class Tech
Рет қаралды 4,2 М.
6 SQL Joins you MUST know! (Animated + Practice)
9:47
Anton Putra
Рет қаралды 253 М.
What’s Up with Laravel? It’s Everywhere, and Here’s Why!
6:22
PHP cURL API Tutorial - Emailable API Integration - Full PHP 8 Tutorial
17:56
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 918 М.
Doctrine ORM - PHP Entities & Data Mapper Pattern - Full PHP 8 Tutorial
26:18
Solving one of PostgreSQL's biggest weaknesses.
17:12
Dreams of Code
Рет қаралды 227 М.
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН