# |
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 |
# |
Apr 21st 2017, 10:27 |
dorxy |
I’m already satisfied with a nudge in the right direction of where to look inside the marshaller class :) |
# |
Apr 21st 2017, 10:26 |
dorxy |
and then on the patched entity the property `B` becomes an array of actual entities of type B, but its own association with C is not loaded, it is just `c_id` |
# |
Apr 21st 2017, 10:25 |
dorxy |
so I’m patching with data like `[‘B’ => [[‘id’ => 1, |
# |
Apr 21st 2017, 10:25 |
dorxy |
it’s just the patch that does not load actual entities more then one level deep |
# |
Apr 21st 2017, 10:25 |
dorxy |
save strategy is append |
# |
Apr 21st 2017, 10:24 |
dorxy |
oh yeah its an array, trying to keep it simple with the ABC ;) saving goes perfectly (although I’m not trying to save any associated entities themselves) |
# |
Apr 21st 2017, 10:24 |
hmic |
if the associated entity marked dirty in the main entity? |
# |
Apr 21st 2017, 10:23 |
hmic |
did you provide an array to the associated option specifing it? whats your save strategy on the asociation? did the same data save in the first place, or is your data structure wrong maybe? |
# |
Apr 21st 2017, 10:21 |
technofection |
@hmic The bottom line is, I already have some records in the hasMany associaton and now wnated to push another new one... So I'd fetch the main entity along with contain, and then push a new entity in the hasMany association array, save the main entity back... This should create a new reocrd in the hasMany table.. But its not doing so :( |
# |
Apr 21st 2017, 10:20 |
dorxy |
I’ve checked the `_buildPropertyMap` function in the marshaller, which created an anonymous function for association B with `['associated' => ['C']]`, but when I try to debug inside that anonymous function it seems to never be called :( |
# |
Apr 21st 2017, 10:18 |
dorxy |
Could someone help me with associations maybe? I’ve got the following entities: A hasMany B and B belongsTo C containing on those entities works, but when I patch an entity with `['associated' => 'B.C']` in the options, C is not loaded as an entity onto B, but I do require it when someone submits a form and there are errors |
# |
Apr 21st 2017, 10:17 |
technofection |
I already have one, and pushed another one in the entity array.. The new one I pushed into the array is not saving, neither there is any error in the main entity :( |
# |
Apr 21st 2017, 10:16 |
technofection |
https://gist.github.com/technofection/f25941b073061eba41b758f9e6f3db47 |
# |
Apr 21st 2017, 10:16 |
hmic |
if you provide only one, it will replace the ones with what you save by the default save strategy |
# |
Apr 21st 2017, 10:15 |
hmic |
check the save strategy on the association |
# |
Apr 21st 2017, 10:15 |
hmic |
!tell technofection about gist |
# |
Apr 21st 2017, 10:15 |
slackebot |
[phone_country_id] => [phone_type_id] => 1 [status] => 0 ) [1] => Array ( [phone_type_id] => 2 [phone] = 2323232323 ) ) ) |
# |
Apr 21st 2017, 10:15 |
technofection |
Array ( [id] => 91 [first_name] => My [middle_name] => [last_name] => Brother [email] => lkjlkj@sdfsdf.co> [birth_date] => [gender] => [preferred_name] => [social_security_number] => [person_phone_numbers] => Array ( [0] => Array ( [id] => 68 [person_id] => 91 [phone] => 7679748636 |