Lazy objects in PHP 8.4

preview_player
Показать описание


#php #whatsnew #webdev
Рекомендации по теме
Комментарии
Автор

I managed to get a hold of Nicolas! The answer is at 32:16

phpannotated
Автор

This is going to be a nightmare in interviews

FaizanAnwerAli
Автор

This sounds like it works the exact same way as ocramius proxy manager, that's awesome!

elliottmarshall
Автор

I don't know if you've thought about it - but it'd be fantastic for an ORM like this to have a 'loaded model cache'. Basically, allow lazy loading, but try and re-use models out of memory if they are available first before loading. Basically trying to fix N+1 issues through an automatic cache instead of lazy loading naively.

havokgames
Автор

I prefer explicitly querying for my objects, thank you

parlor
Автор

Your initial hack with the property unset to trigger __get is great. Unfortunately it won't work with PHP 8.4 property hooks. Hooked property cannot be unset.

I'm glad Nicolas's RFC on lazy object passed.

GromNaN
Автор

How about the doctrine way for lazy objects? It's actually super easy solution. Just use Proxy pattern. This way is used in Java Spring too, if I correct remember

vitalii_sheverov
Автор

Thanks. I like your video as well as the rfc. And yes, I was screaming ;-)

dkroed
Автор

Thank you very much for such an interesting video. I'm just curious, did you say "все" 10:42 ? :)

useruser
Автор

I think it should just try it out. You have multiple lazy objects per class. 1 per property. If 1 is called, only that one is initialized. (I think ;)

reindertvetter
Автор

Honestly I don't get why core team concentrates on such narrow things ? After Nikita Popov left the development the delivery dynamics of cool userland features has been reduced significantly. Instead they biased to develop narrow things which doesn't have much sense for the most php devs. Where are type system improvements, generics, operator overload, pipe operator, etc ?

OleksandrAndreiev
Автор

Oh man, I tried to watch your videos, but I really hate when someone reads material aloud in video, instead of reading it before and summaring it in video

nipph
Автор

Im not through the video yet, but i dont understand why people are using properties instead of getters.
IMO we should use getters and setters only, and properties are "touched" by the object itself only.
And lazy with getters is easy.
EDIT: ok, i stopped watching. This is way to complicated and requires a "Dont worry, i got this. Do not change. If im not working here anymore: good luck" -comment in that code.
:)

CottonInDerTube