activa Posted June 29, 2017 Report Posted June 29, 2017 What is the best and correct query to get all services that use the package X . Basing in the package_group_id return incorrect data for some packages . Quote
Blesta Addons Posted June 29, 2017 Report Posted June 29, 2017 9 hours ago, activa said: What is the best and correct query to get all services that use the package X . Basing in the package_group_id return incorrect data for some packages . take this, i use it and i can get the total services using the package X with option to filter per service status public function getUsedServices($package_id, $service_status = null) { $this->Record->select('services.id')->from('package_pricing')-> innerJoin('services', 'services.pricing_id', '=', 'package_pricing.id', false)-> where('package_pricing.package_id', '=', $package_id); if ($service_status) { $this->Record->where('services.status', '=', $service_status); } return $this->Record->numResults(); } you can use it as getUsedServices($package_id, 'active') to get total active services using the package X Beav and activa 2 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.