Skip to content

Add after save callback#86

Open
it-mob wants to merge 6 commits into
UseMuffin:masterfrom
montreux-oberland-bernois:update-entity
Open

Add after save callback#86
it-mob wants to merge 6 commits into
UseMuffin:masterfrom
montreux-oberland-bernois:update-entity

Conversation

@it-mob

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

Copy link
Copy Markdown

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

@ADmad

ADmad commented Oct 14, 2019

Copy link
Copy Markdown
Member

Tests needed for the new feature.

@it-mob

it-mob commented Oct 14, 2019

Copy link
Copy Markdown
Author

Where can I find the .sqlite file ?

@ADmad

ADmad commented Oct 14, 2019

Copy link
Copy Markdown
Member

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

@it-mob

it-mob commented Oct 15, 2019

Copy link
Copy Markdown
Author

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

saeideng commented Oct 15, 2019

Copy link
Copy Markdown
Contributor

@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

it-mob commented Oct 15, 2019

Copy link
Copy Markdown
Author

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

@it-mob

it-mob commented Oct 15, 2019

Copy link
Copy Markdown
Author

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

@saeideng

Copy link
Copy Markdown
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

it-mob commented Oct 18, 2019

Copy link
Copy Markdown
Author

Thank you for the answer. I pushed my changes

@it-mob

it-mob commented Nov 5, 2019

Copy link
Copy Markdown
Author

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

@ADmad

ADmad commented Nov 5, 2019

Copy link
Copy Markdown
Member

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

Comment thread src/Model/Endpoint.php Outdated
$event = $this->dispatchEvent('Model.afterSave', compact('resource', 'options'));

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

Copy link
Copy Markdown
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

it-mob commented Nov 6, 2019

Copy link
Copy Markdown
Author

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

it-mob commented Dec 18, 2019

Copy link
Copy Markdown
Author

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

it-mob commented May 20, 2020

Copy link
Copy Markdown
Author

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

ADmad commented May 20, 2020

Copy link
Copy Markdown
Member

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