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

Implement ci4 softDelete compatibility #46

Open
nicojmb opened this issue May 22, 2024 · 1 comment
Open

Implement ci4 softDelete compatibility #46

nicojmb opened this issue May 22, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@nicojmb
Copy link

nicojmb commented May 22, 2024

if i've a model with softDelete enabled, the query not skipts this items automatically.

https://codeigniter.com/user_guide/models/model.html#usesoftdeletes

@nicojmb nicojmb added the bug Something isn't working label May 22, 2024
@kangzul
Copy link

kangzul commented Jul 9, 2024

i dont know this is correct answer or not. but i change of code on construction function inside Datatables.php like this

public function __construct($builder)
{
    if (is_subclass_of($builder, '\CodeIgniter\BaseModel') && method_exists($builder, 'builder')) {
        if ($builder->tempUseSoftDeletes) {
            $builder->where($builder->table . '.' . $builder->deletedField, null);
        }
        $builder = $builder->builder();
    }
    $this->query      = new DataTableQuery($builder);
    $this->columnDefs = new DataTableColumnDefs($builder);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants