Are VALUE OBJECTS secretly overpowered?!
Вставка
- Опубліковано 19 сер 2024
- Morning gals and guys.
In today's episode we'll talk about value objects and how they can be used.
Twitter:
/ przylucki_p
More me:
saaslaravel.com
Website:
przemyslawprzy... - Наука та технологія
This is currently my daily favorite channel 🍀 Sooo much indepth about those stuffs
Glad you enjoy it!
Me to 🎉
Awesome! I have used VO for a while but you've made it to the next level...
I hope you can release a tutorial of making mini app using DDD architecture.
Thanks so much! Tutorial on my version DDD is on the immediate roadmap (and a secret project connected to it 😊)
Yep! we need it!
It would be great to have generics in PHP so you could just pass a to your interface and use the Phone instead of a generic ValueObjectInterface for your isEqual definition
That's what I tried to do with phpdoc off camera but couldn't get it to work unfortunately :c
@@saaslaravel So sad... Hopefully, PHP will get native generics one day :D
@@igorleal1798 there is a video by Brent where he explains why PHP can't have generics
@@mediliesActually we can have generics in PHP, just like Python does (comments)
@@TheGajos php annotations have no effect on runtime. they only improve IDE experience and work with static analyzers
I have learned so much from your videos, thank you! This type of videos are just awesome!
Thank you ❤️
Great explanation!
Great videos. Can you explain the difference between DTO & Value Object? Always confuse with this two terms.
Thank you! In simple terms: Value object is a wrapper on a primitive inside of your system - phone, email, point, coupon etc, whereas DTO is an object with all of the data required for execution of a certain logic. DTOs often times include VO
@@saaslaravel Thanks for the clarification! I probably already use DTO without knowing 😖
I was puzzled by the interface. I thought you were going to extend a base value object class and put these common methods there?
We miss you
I may or may not be getting back soon 👀
@@saaslaravel all your your videos are inspiring! Just buil some CRM example with DB structure and it will be the,🚀
Awesome 👌 can i have please the name of theme and the font😅 im addicted!
Thanks! It's called Fira Code
@@saaslaravel 🥳 thanks and theme?
Hey mate! One question if I may, how would you handle transliteration when it comes to slugs in Laravel?
Hey! If you mean replacing characters like "ó" into "o" I think Str::slug handles that out of the box. If you mean localization - you could generate a slug that has a numeric ID and localized slug that's not taken into consideration in route binding i.e. "/blog/1-article"
@@saaslaravel Yes, the first option, thank you very much! :D
I think spatie laravel data package is better for this type of data transformation
It may be, but it's important to be able to understand what's happening under the hood or just being able to implement it from scratch! 😁
@@saaslaravel I agree on this
These look almost the same as the ones implemented in my package `laravel-value-objects` :)
Hi there! I was not familiar with your package but it looks pretty cool - I didn't copy the implementation from there though if that's what you are inferring :)
@@saaslaravel No, I'm just surprised at how close our thoughts are to each other on this topic. Even methods like "from". :))
That's a common approach used in Laravel so that's probably why. I use that all of the time for DTOs as well
Please I need a DDD tutorials
It's def on the roadmap!