# |
Feb 18th 2020, 10:18 |
FunkadelicRelic |
public function beforeMarshal(\Cake\Event\Event $event, \ArrayObject $data, \ArrayObject $options) |
# |
Feb 18th 2020, 10:18 |
FunkadelicRelic |
Thanks @ndm - this works: |
# |
Feb 18th 2020, 10:14 |
challgren |
Thanks! I haven't gotten around to implementing my work around but yours would be good to see to see if I'm headed down the right path |
# |
Feb 18th 2020, 10:13 |
kaliel |
sure |
# |
Feb 18th 2020, 10:13 |
challgren |
@kaliel can you share your code when your done |
# |
Feb 18th 2020, 10:11 |
kaliel |
@challgren @jotpe thanks a lot forpointing me the good direction, got it working. Now i need to add a flash message when redirected :) |
# |
Feb 18th 2020, 10:06 |
Tropix |
now |
# |
Feb 18th 2020, 10:06 |
Tropix |
i'll try it nox |
# |
Feb 18th 2020, 10:05 |
neon1024 |
@Tropix https://book.cakephp.org/3/en/installation.html#permissions |
# |
Feb 18th 2020, 10:05 |
Tropix |
is not writable [CORE/src/Cache/Engine/FileEngine.php, line 412] |
# |
Feb 18th 2020, 10:05 |
Tropix |
error /var/www/html/cakeP/tmp/cache/persistent/ is not writable [CORE/src/Cache/Engine/FileEngine.php, line 412] |
# |
Feb 18th 2020, 10:04 |
Tropix |
i'm working on linux |
# |
Feb 18th 2020, 10:03 |
FunkadelicRelic |
@ndm - Thanks again - I'm going to check that out - brb. |
# |
Feb 18th 2020, 10:03 |
Tropix |
pleas can sameone help me to fix this problem |
# |
Feb 18th 2020, 10:03 |
ndm |
Like ```public function beforeMarshal(\Cake\Event\Event $event, \ArrayObject $data, \ArrayObject $options) { // ... $data['recommendations']['_ids'] = $arrayOfRecommedationPrimaryKeys; }``` https://pastebin.com/1TWSExQP |
# |
Feb 18th 2020, 10:03 |
Tropix |
Hi |
# |
Feb 18th 2020, 10:00 |
ndm |
I didn't mean to say that you should _save_ the data in `beforeMarshal`, just that you should modify it there, so that in your controller you'll receive the proper data required for saving your associations! |
# |
Feb 18th 2020, 09:59 |
FunkadelicRelic |
The assessment saves OK, but no related recommendations. |
# |
Feb 18th 2020, 09:58 |
FunkadelicRelic |
For simplicity I'm just getting the first reccomendation with ID 1 until I understand what's going on - then the idea is I will get all the recommendations based on something in the add form the user has selected. |
# |
Feb 18th 2020, 09:58 |
FunkadelicRelic |
$data->recommendations = $recs; |
# |
Feb 18th 2020, 09:58 |
FunkadelicRelic |
} |
# |
Feb 18th 2020, 09:58 |
FunkadelicRelic |
$recs = TableRegistry::getTableLocator()->get('Recommendations')->get(1); |
# |
Feb 18th 2020, 09:58 |
FunkadelicRelic |
{ |
# |
Feb 18th 2020, 09:58 |
FunkadelicRelic |
public function beforeMarshal(\Cake\Event\Event $event, \ArrayObject $data, \ArrayObject $options) |
# |
Feb 18th 2020, 09:57 |
FunkadelicRelic |
I have an assessment that I would like to save with associated recommendations. In beforeMarshal I'm getting a recommendation but I don't know how to add it to the assessment. |
# |
Feb 18th 2020, 09:56 |
FunkadelicRelic |
Hey all - I'm trying to save some related data in beforeMarshal but not having much luck - I'm definitely doing something wrong. |
# |
Feb 18th 2020, 09:52 |
alexdd55976 |
any ideas? |
# |
Feb 18th 2020, 09:52 |
alexdd55976 |
plus: i habe no code completion on the parameters that the element expects |
# |
Feb 18th 2020, 09:51 |
alexdd55976 |
calling an element through a helper does not look natural, but whats the better way? adding a bunch of paramters into `$this->element('foo', [])`does not seem right either |
# |
Feb 18th 2020, 09:43 |
kaliel |
i'm trying to make it out but for now i still got a 403, maybe because i have the RequestAuthorizationMiddleware after the AuthorizationMiddleware |
# |
Feb 18th 2020, 09:42 |
challgren |
@kaliel it is in the docs https://book.cakephp.org/authorization/2/en/middleware.html#handling-unauthorized-requests |
# |
Feb 18th 2020, 09:30 |
kaliel |
my thought is that many people will need this, should it be added to the docs ? |
# |
Feb 18th 2020, 09:29 |
jotpe |
np :fist: |
# |
Feb 18th 2020, 09:29 |
kaliel |
@jotpe wow this is exactly what i need !!! |
# |
Feb 18th 2020, 09:28 |
kaliel |
i'll give a look thx a lot |
# |
Feb 18th 2020, 09:27 |
jotpe |
https://github.com/cakephp/authorization/blob/master/docs/en/middleware.rst#handling-unauthorized-requests |
# |
Feb 18th 2020, 09:27 |
jotpe |
@kaliel I didn't try myself, but did you try to set the RedirectHandler in the middleware? |
# |
Feb 18th 2020, 09:27 |
neon1024 |
`composer require dereuromark/doorbell` |
# |
Feb 18th 2020, 09:20 |
challgren |
And I wouldnt get to pester @dereuromark as much! |
# |
Feb 18th 2020, 09:19 |
challgren |
Plus if I worked normal hours I’d miss out on all the time hanging with yall |
# |
Feb 18th 2020, 09:19 |
challgren |
My door bell is through my phone, callbox for apartment complex |