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

FixTree should allow selecting extra columns #501

Open
walkingCommiter opened this issue Mar 22, 2021 · 1 comment
Open

FixTree should allow selecting extra columns #501

walkingCommiter opened this issue Mar 22, 2021 · 1 comment

Comments

@walkingCommiter
Copy link

What happens:
In QueryBuilder:fixTree() method there is a section where the code is choosing the "to be selected" columns. This line raises an issue for us since our Entity requires an extra column to be selected or else the fix tree will fail when trying to load nodes in the next lines.

 public function fixTree($root = null)
    {
        $columns = [
            $this->model->getKeyName(),
            $this->model->getParentIdName(),
            $this->model->getLftName(),
            $this->model->getRgtName(),
            'cloud_id', // <--- our model needs this  cloud id to be properly loaded in case of passive caching
        ];

Expected Behavior:
The solution is rather simple. Just allow selecting extra columns as optional. No extra change is needed:

Here is the solution:

    public function fixTree($root = null, array $extra = [])
    {
        $columns = [
            $this->model->getKeyName(),
            $this->model->getParentIdName(),
            $this->model->getLftName(),
            $this->model->getRgtName(),
        ] + $extra;

This would solve our issue and possibly any other code that has multiple clouds.

Thanks.
cc: @pultho

@walkingCommiter
Copy link
Author

PR opened:
#502

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

No branches or pull requests

1 participant