27 lines
1.1 KiB
PHP
27 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace KupShop\ElninoBundle\Routing;
|
|
|
|
use KupShop\KupShopBundle\Util\StringUtil;
|
|
|
|
class LocalePrefixAwareRouter extends \KupShop\LocalePrefixBundle\Routing\LocalePrefixAwareRouter
|
|
{
|
|
public function generateInLanguage($language, $routeName, $params = [])
|
|
{
|
|
switch ($routeName) {
|
|
case 'kupshop_elnino_model_model':
|
|
$query = sqlQueryBuilder()->select("CONCAT(COALESCE(st.name,s.name),' ',am.short_title)")
|
|
->from('abra_models', 'am')
|
|
->join('am', 'abra_sections', 'abs', 'am.id_section=abs.id_abra')
|
|
->join('abs', 'sections', 's', 'abs.id_section=s.id')
|
|
->leftJoin('s', 'sections_translations', 'st', "s.id=st.id_section AND st.id_language = '{$language}'")
|
|
->where(\Query\Operator::equals(['am.old_kupshop_id' => $params['id']]))
|
|
->setMaxResults(1)->execute()->fetchColumn();
|
|
$params['name'] = StringUtil::slugify($query);
|
|
break;
|
|
}
|
|
|
|
return parent::generateInLanguage($language, $routeName, $params);
|
|
}
|
|
}
|