/** * Update slug services by host * * @param int $iHostId * @param string $sHostName */ public static function updateSlugServices($iHostId, $sHostName) { $aServices = array(); $db = Di::getDefault()->get('db_centreon'); $repository = "CentreonConfiguration\\Repository\\ServiceRepository"; $repository::setObjectName("Service"); $repository::setObjectClass("\\CentreonConfiguration\\Models\\Service"); $oModel = "CentreonConfiguration\\Models\\Service"; $oSlugify = new CentreonSlugify($oModel, $repository); // get services $aHostServices = HostServiceRelation::getMergedParameters(array('host_id'), array('service_id', 'service_description', 'service_alias'), -1, 0, null, "ASC", array('host_id' => $iHostId), "OR"); foreach ($aHostServices as $key => $oService) { $sString = $sHostName . " " . $oService['service_description']; $sSlug = $oSlugify->slug($sString); Service::updateSlug($oService['service_id'], $sSlug); } }