Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add after save callback #86

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

it-mob
Copy link

@it-mob it-mob commented Oct 14, 2019

When an API returns a different result than the submitted data, we use "AfterSave" callback to catch this result

@ADmad
Copy link
Member

ADmad commented Oct 14, 2019

Tests needed for the new feature.

@it-mob
Copy link
Author

it-mob commented Oct 14, 2019

Where can I find the .sqlite file ?

@ADmad
Copy link
Member

ADmad commented Oct 14, 2019

What sqlite file? If you are referring to the test suite it uses an in memory sqlite db by default, no file.

@it-mob
Copy link
Author

it-mob commented Oct 15, 2019

Thank you for the information.
I changed the URL of the sqlite file "webservice_test.sqlite" in the boostrap file with ":memory:" so that the tests start on Windows

@saeideng
Copy link
Contributor

saeideng commented Oct 15, 2019

@it-mob
Admad meant you have to add testCase like these https://github.com/UseMuffin/Webservice/tree/master/tests/TestCase
so that this helps to ensure that this change works well now and in future

@it-mob
Copy link
Author

it-mob commented Oct 15, 2019

@saeideng
Yes sure. I'm working on it.

@it-mob
Copy link
Author

it-mob commented Oct 15, 2019

I added the tests but I don't understand the error of PHPSTAN during the CI tests

@saeideng
Copy link
Contributor

probably something that fixed in phpstan and now should not be this error in ignore list
you can remove this error from /phpstan.neon file

@it-mob
Copy link
Author

it-mob commented Oct 18, 2019

Thank you for the answer. I pushed my changes

@it-mob
Copy link
Author

it-mob commented Nov 5, 2019

Hello,
Do you expect something else from me so that my PR can be validated ?

@ADmad
Copy link
Member

ADmad commented Nov 5, 2019

Sorry for the delay, I'll review the changes soon.

$event = $this->dispatchEvent('Model.afterSave', compact('resource', 'options'));

if ($event->isStopped()) {
return $event->result;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this to $event->getResult().

@it-mob
Copy link
Author

it-mob commented Nov 6, 2019

Thank you for the answer.
I just realized that the callbacks beforeDelete/afterDelete were missing.
I will add them and update my PR soon

@it-mob
Copy link
Author

it-mob commented Dec 18, 2019

Hello,

I just made a new commit with before & after delete callbacks but I have errors with Travis.
I think the problem is the line break format (CRLF & CF)
Can you help me solve this problem? (I work on Windows)

Thank you.

@it-mob
Copy link
Author

it-mob commented May 20, 2020

Hello,
I wanted to know if you're still expecting something from me about that PR.
I tried again to fix the PHPCS problem but without success.
Thank you

@ADmad
Copy link
Member

ADmad commented May 20, 2020

Sorry, I had forgotten about this. NVM the phpcs issue. I can take care of it.

But I am now leaning towards targeting this enhancement to the cake-4.x branch (which is compatible with CakePHP 4) instead of master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants