Description
For example:
You have a UserService where you call withDepth() function and before that line of code is reached, your model user model gobal scope join is added to query. Then there is an error that coulmn xy is not found in table users.
UserModel:
$query->join('user_relation_clients', function ($join) use ($currentClientId) { $join->on('users.id', '=', 'user_relation_clients.user_id') ->where('user_relation_clients.client_id', $currentClientId); });
UserService:
$user->withDepth()->having('depth', '=', $this->request->get('depth'));
Error:
select *, (select count(1) - 1 from
usersas
_dinner join
user_relation_clientson
users.
id=
user_relation_clients.
user_idand
user_relation_clients.
auth_client_id= 2ea431c9-5218-4a96-89d2-587e441725ba where
users.
_lftbetween
_d.
_lftand
_d.
_rgt) as
depthfrom
usersinner join
user_relation_clientson
users.
id=
user_relation_clients.
user_idand
user_relation_clients.
auth_client_id= 2ea431c9-5218-4a96-89d2-587e441725ba where
is_published= 1 and
users.
_lftbetween 38 and 54 having
depth= 1 order by
order_no asc
@lazychaser is there any workaround ?
Activity
mackhankins commentedon Nov 26, 2019
I think there is a pull request yet to be merged for this.
#300