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

Trait method performDeleteOnModel collides with SoftDelete trait #5

Closed
sebastiaanluca opened this issue Mar 3, 2016 · 5 comments
Closed
Labels

Comments

@sebastiaanluca
Copy link

Trait method performDeleteOnModel has not been applied, because there are collisions with other trait methods on User.

\Illuminate\Database\Eloquent\SoftDeletes has the same method protected function performDeleteOnModel(). Can I use these together somehow? Should I just use the method from the soft delete trait?


Small update: both traits also define the $forceDeleting property, which cannot be rewritten or aliased. Why exactly is it being use? There's no need for it?

@hootlex hootlex added the bug label Mar 4, 2016
@hootlex
Copy link
Owner

hootlex commented Mar 4, 2016

Thanks for reporting.

I will try to find a workaround to be able to use it along with SoftDeletes.

About $forceDeleting you are right, it is useless :)

@sebastiaanluca
Copy link
Author

@hootlex Used SoftDeletes::performDeleteOnModel insteadof Moderatable; in my model to favor the soft delete method. I think I can get away with this as Moderatable just finds it without scope and force deletes it.

The only thing that's keeping me from using soft delete now is that $forceDeleting variable :) Should I fork this library and use that or are you able to quickly delete that line and push to packagist?

@hootlex
Copy link
Owner

hootlex commented Mar 5, 2016

I have removed the unused variable in v1.0.4.

The only reason performDeleteOnModel exists is to achieve compatibility with Laravel 5 (#1) but I consider removing it.

Can you provide more details about SoftDeletes::performDeleteOnModel insteadof Moderatable?

@sebastiaanluca
Copy link
Author

Thanks! Updating right now :)

When using both traits, I just make it use the SoftDeletes performDeleteOnModel method using:

use SoftDeletes, Moderatable {
    SoftDeletes::performDeleteOnModel insteadof Moderatable;
}

@hootlex
Copy link
Owner

hootlex commented Mar 5, 2016

You are welcome.
Function performDeleteOnModel has been removed in v1.0.5, so you can use it normally.

@hootlex hootlex closed this as completed Mar 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants