Comments (3)
At first I had tried to write a behavior instead of a trait, but did not manage to do what I wanted.
With a behavior, you cannot override Model::delete(). So the way to do is to catch the beforeDelete event in the behavior, update the soft delete field, and then stop the propagation of the event to avoid the hard deletion to happen. But by doing so, you prevent the cascade deletion to other models as well as counter cache updates, which I think was not satisfactory.
But if you find a way to make all this work with a behavior, feel free to convert it!
from cakephp3-soft-delete.
I will try to find a way but thank's for your information.
from cakephp3-soft-delete.
For now I see no solution to override the delete()
-method. What do you think about implementing this trait into the Utils-plugin to make it easier to use (because you got a big library)...
from cakephp3-soft-delete.
Related Issues (20)
- [Enhancement] Adding the possibility to select 'onlyDeleted' like we do with 'withDeleted' HOT 3
- Query::delete() still hard delete HOT 2
- How to restore soft deleted record HOT 2
- deleteAll doesn't delete associations HOT 2
- Can't execute the validation of uniqueness in using this plugin . HOT 1
- Soft deleted records should be fetched for belongsTo association queries. HOT 2
- Docs error: error with syntax in documentation HOT 1
- Soft deleting not propagating to associations HOT 1
- Allow custom data type for $softDeleteField
- pagination can't view softDeleted item. HOT 1
- Auth login not working with sofdelete plugin HOT 1
- softdelete update for cakephp 3.6
- receive depreciate error
- Matching query clauses use wrong alias
- withDeleted parameter is not passed to contained tables HOT 1
- Validation IsUnique problem with softdeleted item HOT 1
- make compatible with cakephp 4 HOT 2
- Hard deleting with associations HOT 3
- Possibility to "contain" deleted records from join table HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cakephp3-soft-delete.