Log message #4202206

# At Username Text
# 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?
# Sep 6th 2019, 18:34 ricksaccous why wouldn't you use that, why are you using patchEntity?
# Sep 6th 2019, 18:34 ricksaccous @racmiroslav so you are doing that and the data isn't hyrdrating?
# Sep 6th 2019, 18:33 slackebot <ricksaccous>
# Sep 6th 2019, 18:32 ndm @emiliano Well I assumed that it's your own plugin... unless there's events you can hook in, then overriding might be the way to go. Maybe you should remove the behavior that is added by the `ApiUsersTable` class that you're extending (ie replace it so to speak), but I'm not sure as I don't know what exactly that plugin is doing.
# Sep 6th 2019, 18:30 ricksaccous you're right, i just like doing it, lol
# Sep 6th 2019, 18:30 racmiroslav associated is not required for first level associations, afaik
# Sep 6th 2019, 18:29 ricksaccous in case that's the issue
# Sep 6th 2019, 18:29 slackebot 'payment' => NULL, ), '_original' => array ( ), '_hidden' => array ( ), '_virtual' => array ( ), '_className' => NULL, '_dirty' => array ( 'document' => true, 'type' => true, 'payment' => true, ), '_new' => true, '_errors' => array ( ), '_invalid' => array ( ), '_registryAlias' => 'Payments.PaymentDocuments', ))```
# Sep 6th 2019, 18:29 racmiroslav @ricksaccous this is output for `newEntity` method. both properties are set to `NULL`. I am sure that they are not null ```‌Payments\Model\Entity\PaymentDocument::__set_state(array( '_accessible' => array ( 'payment_id' => true, 'document_id' => true, 'type' => true, 'created' => true, 'payment' => true, 'document' => true, ), '_properties' => array ( 'document' => NULL, 'type' => 'invoice',
# Sep 6th 2019, 18:29 ricksaccous make sure you do 'associated'
# Sep 6th 2019, 18:29 ricksaccous nvm
# Sep 6th 2019, 18:29 ricksaccous oh, you are setting data
# Sep 6th 2019, 18:29 ricksaccous it probably has to do with the marshaller not getting exactly what it expects
# Sep 6th 2019, 18:28 ricksaccous @racmiroslav why don't you do things more standard and use newEntity and set those items in newEntity?
# Sep 6th 2019, 18:27 slackebot 'invoice', ), '_original' => array ( ), '_hidden' => array ( ), '_virtual' => array ( ), '_className' => NULL, '_dirty' => array ( 'type' => true, ), '_new' => true, '_errors' => array ( ), '_invalid' => array ( ), '_registryAlias' => NULL, ))``` as you can see, only property `type` was set although both properties `payment` and `document` are accessible. why?
# Sep 6th 2019, 18:27 racmiroslav `$this->PaymentDocuments->patchEntity(new PaymentDocument, ['document' => $payment->invoice, 'type' => 'invoice', 'payment' => $payment]);` results in ```‌Payments\Model\Entity\PaymentDocument::__set_state(array( '_accessible' => array ( 'payment_id' => true, 'document_id' => true, 'type' => true, 'created' => true, 'payment' => true, 'document' => true, ), '_properties' => array ( 'type' =>
# Sep 6th 2019, 18:25 emiliano I use aws Elastic Beanstalk, I dont wanna push the folder vendor, only need change this function, for generated a TemporaryPassword when I create a user
# Sep 6th 2019, 18:23 emiliano I only need to change the createCognitoUser