# |
Mar 6th 2018, 12:11 |
savant |
i generally find virtual fields to be an anti-pattern |
# |
Mar 6th 2018, 12:11 |
popperz0r |
im screwed |
# |
Mar 6th 2018, 12:11 |
popperz0r |
now i need a condition on full_name :) |
# |
Mar 6th 2018, 12:11 |
popperz0r |
:( |
# |
Mar 6th 2018, 12:07 |
savant |
@popperz0r not really, no |
# |
Mar 6th 2018, 12:07 |
savant |
and I write tests for whatever is necessary |
# |
Mar 6th 2018, 12:07 |
savant |
if the data isnt there, I raise an exception |
# |
Mar 6th 2018, 12:06 |
ghoritrilochan |
5.6.34 |
# |
Mar 6th 2018, 12:06 |
savant |
@makallio85 as I said, I dont use lazy loading. I basically always use a find query, and then in the find query, chain a “default” find |
# |
Mar 6th 2018, 12:06 |
makallio85 |
I mean entities relying on associations |
# |
Mar 6th 2018, 12:06 |
makallio85 |
@savant Do you have such behavior in your projects and how have you resolved such needs? |
# |
Mar 6th 2018, 12:06 |
savant |
@ghoritrilochan what version of php are you running? |
# |
Mar 6th 2018, 12:05 |
popperz0r |
virtual properties* |
# |
Mar 6th 2018, 12:05 |
popperz0r |
Is it possible to create a model condition based on virtual entities? |
# |
Mar 6th 2018, 12:05 |
popperz0r |
Hello |
# |
Mar 6th 2018, 12:03 |
ghoritrilochan |
hi.. plz help.. what mining of this error and how to solve this : [05-Mar-2018 21:38:29 UTC] PHP Fatal error: require(): Failed opening required 'C:\Inetpub\vhosts\abc.com\httpdocs/config/requirements.php' (include_path='.;.\includes;.\pear') in C:\Inetpub\vhosts\abc.com\httpdocs\webroot\index.php on line 19 |
# |
Mar 6th 2018, 12:03 |
savant |
https://github.com/jeremyharris/cakephp-lazyload |
# |
Mar 6th 2018, 12:03 |
makallio85 |
Yeah, saw that discussion as well |
# |
Mar 6th 2018, 12:03 |
savant |
but as I said, there is a plugin (by one of the core devs) to enable it |
# |
Mar 6th 2018, 12:03 |
savant |
we dont think its a great pattern in general |
# |
Mar 6th 2018, 12:03 |
savant |
we’ve talked on the core team about enabling lazy loading |
# |
Mar 6th 2018, 12:02 |
savant |
no problem |
# |
Mar 6th 2018, 12:00 |
makallio85 |
Thanks for your opinion. Generally I was just looking confirmation for my guesses. |
# |
Mar 6th 2018, 11:59 |
savant |
so no, I dont think that breaks the idea of an entity |
# |
Mar 6th 2018, 11:59 |
savant |
and should be hydrated before use |
# |
Mar 6th 2018, 11:59 |
makallio85 |
Yeah. Agree. |
# |
Mar 6th 2018, 11:59 |
savant |
it shouldnt know anything about getting data |
# |
Mar 6th 2018, 11:59 |
savant |
but the idea here is that an entity is dumb |
# |
Mar 6th 2018, 11:58 |
savant |
it _can_ query if you enable lazy loading - there is a plugin for this - or if you chain things off of Entity::source() |
# |
Mar 6th 2018, 11:58 |
savant |
a query is a bag of data |
# |
Mar 6th 2018, 11:58 |
makallio85 |
If i send exceptions |
# |
Mar 6th 2018, 11:57 |
makallio85 |
It does not user to allow query anymore without required contains. |
# |
Mar 6th 2018, 11:57 |
makallio85 |
But in general you dont think that it breaks the idea of entity? |
# |
Mar 6th 2018, 11:56 |
makallio85 |
Sounds reasonable |
# |
Mar 6th 2018, 11:53 |
savant |
based on my experience with lazy-loading in rails |
# |
Mar 6th 2018, 11:53 |
savant |
I just think that it tends to lead to n+1 queries |
# |
Mar 6th 2018, 11:52 |
savant |
I use custom finders for everything, so its pretty easy for me to just ensure things are there than hunt down random find() calls. |
# |
Mar 6th 2018, 11:52 |
makallio85 |
Is there something particular you hate in lazy loading? |
# |
Mar 6th 2018, 11:49 |
savant |
and also write tests for my use cases so that I know that the calls are being made correctly |
# |
Mar 6th 2018, 11:48 |
savant |
And would say that if the property is missing but is required, I would throw an exception |
# |
Mar 6th 2018, 11:48 |
savant |
I personally hate lazily-loading data |