-
Notifications
You must be signed in to change notification settings - Fork 254
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
deleteCallback to delete different versions of a file #454
Conversation
docs/configuration.rst
Outdated
- Available arguments: | ||
|
||
- ``string $path``: Basepath of the file you want to delete | ||
- ``object $entity``: The entity you want to delete |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would actually specify 'Entity' instead of 'object' here, just to be clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed.
@@ -28,7 +28,8 @@ public function setup() | |||
'error' => UPLOAD_ERR_OK, | |||
'size' => 1, | |||
'type' => 'text', | |||
'keepFilesOnDelete' => false | |||
'keepFilesOnDelete' => false, | |||
'deleteCallback' => false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My personal preference would be null
here to demonstrate a 'nothing' value, rather than a boolean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just saw nameCallback also uses null as default, will change this accordingly.
|
||
$behavior->config($this->dataOk); | ||
|
||
// expecting getPathProcessor to be called with right arguments for dataOk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about committing comments to the repo, but the repo code style will be up to @josegonzalez
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it's just because I copied code from https://github.com/FriendsOfCake/cakephp-upload/blob/master/tests/TestCase/Model/Behavior/UploadBehaviorTest.php#L415
Will delete the comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might not be a big deal as it's in a test. Although I do wonder if you have to comment each assert, does that mean they could be different test cases? Just a thought.
I would also probably throw in a test case for when Otherwise, reading the code, it seems okay to me. Perhaps just a quick check with PHPCS if you've not already done that. |
Seems fine, needs an example. |
nice return
good job 👍 |
Ref #453
I'll add an example to the docs if this feature gets approved.