# |
Sep 6th 2019, 20:13 |
ricksaccous |
i'm so glad contain still exists |
# |
Sep 6th 2019, 20:12 |
alexdd55976 |
all made by myself |
# |
Sep 6th 2019, 20:12 |
alexdd55976 |
online shop |
# |
Sep 6th 2019, 20:12 |
alexdd55976 |
its not too bad |
# |
Sep 6th 2019, 20:12 |
ricksaccous |
lol |
# |
Sep 6th 2019, 20:12 |
ricksaccous |
you enjoy it? @alexdd55976 |
# |
Sep 6th 2019, 20:11 |
alexdd55976 |
cake1.x :) |
# |
Sep 6th 2019, 20:11 |
alexdd55976 |
oh.. finally working on an old project again… |
# |
Sep 6th 2019, 19:59 |
ricksaccous |
TableClass->setConnection('connectionName'); |
# |
Sep 6th 2019, 19:55 |
itmpls |
a table's `defaultConnectionName` method returns the schema to use, but what if im looping through multiple ones? what's a recommended way to set that dynamically? |
# |
Sep 6th 2019, 19:34 |
emiliano |
ok, I will test, thanks a lot |
# |
Sep 6th 2019, 19:30 |
ndm |
``` $this->removeBehavior('AwsCognito'); $this->addBehavior('CognitoUsers'); ``` |
# |
Sep 6th 2019, 19:29 |
ndm |
The `implementedMethods` option will just create an alias that you can call via the table object where the behavior is attached to, it won't change any implementation details. Extending the behavior is OK if you need to change what it does, just unload the original behavior first. |
# |
Sep 6th 2019, 19:29 |
ndm |
What would you expect that code to do? |
# |
Sep 6th 2019, 19:28 |
emiliano |
sorry for the trouble but I'm working with that and thanks a lot for your time |
# |
Sep 6th 2019, 19:25 |
emiliano |
$this->addBehavior('CognitoUsers', Configure::read('AwsCognito')); $this->addBehavior('CognitoUsers', [ 'implementedMethods' => [ 'beforeSaveIdata' => 'beforeSave', ] ] ); |
# |
Sep 6th 2019, 19:25 |
emiliano |
and this: |
# |
Sep 6th 2019, 19:25 |
slackebot |
Best solution for most cases. */ $entity = $this->createCognitoUserIdata($entity); }else{ //enable/disable user if($entity->active andand $entity->isDirty('active')){ $this->enableCognitoUser($entity); }elseif(!$entity->active andand $entity->isDirty('active')){ $this->disableCognitoUser($entity); } } } |
# |
Sep 6th 2019, 19:25 |
emiliano |
protected $_defaultConfig = [ 'implementedMethods' => [ 'beforeSaveIdata' => 'beforeSave', ] ]; public function beforeSaveIdata(Event $event, EntityInterface $entity, ArrayObject $options) { if($entity->isNew()){ /* better to have the cognito creation callback be beforeSave instead of afterSave, so that we only create users once we're sure they're in the cognito user pool. |
# |
Sep 6th 2019, 19:24 |
emiliano |
if use a public function? for example, I test but dont work beforeSaveIdata -> beforeSave |
# |
Sep 6th 2019, 19:23 |
emiliano |
Is there no way to use only that function that I need to replace? |
# |
Sep 6th 2019, 19:22 |
emiliano |
ok, thanks a lot |
# |
Sep 6th 2019, 19:15 |
ndm |
@emiliano `createCognitoUser` is not an exposed/public method, so your config will just hide all public methods, resolving the naming conflict. Looking at the source of the plugin you should consider my other suggestion, that is unload the original behavior, otherwise both behaviors will run, and you don't want that. |
# |
Sep 6th 2019, 19:14 |
daniel.upshaw |
Any word on when Cake 4 will be released? |
# |
Sep 6th 2019, 19:11 |
emiliano |
I need that instead of createCognitoUser use createCognitoUserIdata is ok? |
# |
Sep 6th 2019, 19:09 |
emiliano |
It doesn't throw error now, but keep taking the other function createCognitoUser |
# |
Sep 6th 2019, 19:09 |
emiliano |
I do this: protected $_defaultConfig = [ 'implementedMethods' => [ 'createCognitoUserIdata' => 'createCognitoUser', ] ]; |
# |
Sep 6th 2019, 18:37 |
ricksaccous |
yeah that's prob the easiest option |
# |
Sep 6th 2019, 18:37 |
racmiroslav |
@ricksaccous thank you. I will set ID’s directly then |
# |
Sep 6th 2019, 18:37 |
ricksaccous |
request data type data |
# |
Sep 6th 2019, 18:37 |
ricksaccous |
not the actual entities |
# |
Sep 6th 2019, 18:37 |
ricksaccous |
yeah, when you use newEntity it expects request data |
# |
Sep 6th 2019, 18:36 |
ricksaccous |
you might be able to do $payment->invoice->toArray(); |
# |
Sep 6th 2019, 18:36 |
racmiroslav |
@ricksaccous ok, that is the problem. I did not know that. |
# |
Sep 6th 2019, 18:36 |
ricksaccous |
if $payment->invoice is already an entity it won't work |
# |
Sep 6th 2019, 18:36 |
ricksaccous |
you do realize you can't pass an entity right? it has to be request data |
# |
Sep 6th 2019, 18:36 |
ricksaccous |
@racmiroslav let me see the $payment->invoice |
# |
Sep 6th 2019, 18:35 |
racmiroslav |
@ricksaccous I use exactly the same code as you sent, just different variable names. |
# |
Sep 6th 2019, 18:34 |
ricksaccous |
that's the most common mistake |
# |
Sep 6th 2019, 18:34 |
ricksaccous |
perhaps your data is not formatted properly |
# |
Sep 6th 2019, 18:34 |
ricksaccous |
and is the data you are passing an array? |