# |
Apr 21st 2017, 11:31 |
julez |
e.g. i want to find all BlogPosts, which have a special value in associated Comments Model |
# |
Apr 21st 2017, 11:30 |
julez |
is there a possibility to use conditions in associated models in cake2.x |
# |
Apr 21st 2017, 11:29 |
julez |
hello |
# |
Apr 21st 2017, 11:24 |
hmic |
admad: same with me :O |
# |
Apr 21st 2017, 11:24 |
admad |
Then read manual for how to paginate 2 models together |
# |
Apr 21st 2017, 11:23 |
xety |
Ahhh yeah i see, thanks ! |
# |
Apr 21st 2017, 11:23 |
admad |
You alias it in table registery |
# |
Apr 21st 2017, 11:22 |
xety |
Hmm ok, but how to create an alias for the paginator ? Is there an option ? |
# |
Apr 21st 2017, 11:22 |
admad |
My answer is just theoretical, never even paginated 2 different models on same page |
# |
Apr 21st 2017, 11:21 |
hmic |
which makes me way more confident on my answer... |
# |
Apr 21st 2017, 11:20 |
admad |
We basically said the same thing :) |
# |
Apr 21st 2017, 11:20 |
hmic |
thanks for the backup admad :D |
# |
Apr 21st 2017, 11:19 |
hmic |
so maybe you start with that first |
# |
Apr 21st 2017, 11:19 |
admad |
I think the paginator component and now support paginating multiple models, so maybe you can paginate the same one twice by aliasing it |
# |
Apr 21st 2017, 11:19 |
hmic |
my best bet: give the both paginators different table aliases to work with, so the params are seperatable from the url. it will still not work just out of the box, as with any other 2 paginators on the same page |
# |
Apr 21st 2017, 11:18 |
hmic |
think of the url params the paginator uses... it will mess up without you changeing a lot |
# |
Apr 21st 2017, 11:18 |
xety |
Ah, ok. Do you have any tips on how to do it please ? |
# |
Apr 21st 2017, 11:17 |
hmic |
xety: well, possible. but not "nice" |
# |
Apr 21st 2017, 11:15 |
xety |
Hello, It is possible to paginate 2 query from the same Model in the same view of course ? |
# |
Apr 21st 2017, 11:14 |
dorxy |
ok, thanks @hmic :slightly_smiling_face: |
# |
Apr 21st 2017, 11:14 |
dorxy |
and there’s the issue, the save gives errors on the new entities added (restrictions) and then my edit form gives errors because it cannot find C on B |
# |
Apr 21st 2017, 11:14 |
hmic |
you dont need the plugin, just check in the getter for your virutal field if the data is loaded, if not TableRegisty::get('Table')->find() in the getter |
# |
Apr 21st 2017, 11:13 |
admad |
They won't, you need to do a find again after saving |
# |
Apr 21st 2017, 11:13 |
dorxy |
but I will check out the LazyLoad plugin @hmic, might be just what I need :slightly_smiling_face: |
# |
Apr 21st 2017, 11:12 |
dorxy |
the old ones do |
# |
Apr 21st 2017, 11:12 |
dorxy |
Yes I am, but when I then patch, en the array of A->b is extended, the ‘new’ entities in b do not have C |
# |
Apr 21st 2017, 11:12 |
admad |
So contain it when doing find |
# |
Apr 21st 2017, 11:12 |
hmic |
no, that had been for technofection |
# |
Apr 21st 2017, 11:11 |
hmic |
dorxy: you can lazy load it (maybe) |
# |
Apr 21st 2017, 11:11 |
dorxy |
@hmic I thought you were talking to me at 12:23 :slightly_smiling_face: |
# |
Apr 21st 2017, 11:11 |
dorxy |
@admad I want an entity for C since one of the virtual properties of B uses a property of C |
# |
Apr 21st 2017, 11:10 |
admad |
hmic! |
# |
Apr 21st 2017, 11:09 |
admad |
Also if B belongs to C you don't then just having c_id in B is enough, why do want an entity for C? |
# |
Apr 21st 2017, 11:07 |
hmic |
dorxy: i have not talked to you lately, why do you refer to me all the time? :~ |
# |
Apr 21st 2017, 11:06 |
admad |
Marshaller doesn't load any any entities from db. If you want an associate entity should be patched it should be fetched before hand using contain () |
# |
Apr 21st 2017, 11:01 |
dorxy |
@hmic I think I'm trying to do something that is not supported in the marshaller, I might have to extend find in B and always contain on C by default |
# |
Apr 21st 2017, 10:55 |
technofection |
yo ! But now need to go back and find out the location where I read that earlier.. LOL :slightly_smiling_face: |
# |
Apr 21st 2017, 10:54 |
hmic |
hurray! you found the light switch in the dark :) |
# |
Apr 21st 2017, 10:47 |
technofection |
Hi @hmic, you caught me! The main entity is not dirty! And now I remember, somewhere I read that while pushing entities to hasMany relationship array, I need to manually mark it dirty! |
# |
Apr 21st 2017, 10:46 |
sjundee |
Hi. I use CookieComponent, and to set expiring date I use `$this->Cookie->configKey('Employee', ['expires' => '+365 days']);`, but the cookie expires in 1 month. Any Ideas? |
# |
Apr 21st 2017, 10:34 |
dorxy |
Or maybe I'm trying to achieve something thats not possible |