public function onBuildServiceSearchEmployeesQuery(mixed &$query, object $servicearray $options) : void

Fires while loading the employees assigned to the service to display.


Description

Trigger hook to manipulate at runtime the query used to load the employees available for the service to display under the Service Details page in the front-end.

Third party plugins can extend the query by applying further conditions or selecting additional data.


Parameters

&$query

(mixed)  Either a query builder object or a plain string.

$service

(object)  An object holding the details of the service to display.

$options

(array)  An array of options.

  • id_service - the ID of the service to load;
  • id_employee - the ID of the employee assigned to the specified service.

Return Value

None.


Example

The example below always excludes the employee with ID #5.

/**
 * Trigger hook to manipulate the query at runtime. Third party plugins
 * can extend the query by applying further conditions or selecting
 * additional data.
 *
 * @param   mixed   &$query   Either a query builder or a query string.
 * @param   object  $service  The service details.
 * @param   array   $options  An array of options.
 *
 * @return  void
 */
public function onBuildServiceSearchEmployeesQuery(&$query, $service, $options)
{
    $query->where("`e`.`id` <> 5");
}

Changelog

Version Description
1.7.4 Introduced.
Last Update: 2024-05-14 14:11
Helpful?