mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 06:28:46 +02:00
Enhance Service locator
This commit is contained in:
@@ -15,8 +15,8 @@ use Combodo\iTop\Forms\IO\Format\ClassIOFormat;
|
||||
use Combodo\iTop\Forms\Register\IORegister;
|
||||
use Combodo\iTop\Forms\Register\OptionsRegister;
|
||||
use Combodo\iTop\Forms\Register\RegisterException;
|
||||
use Combodo\iTop\Service\DependencyInjection\DIException;
|
||||
use Combodo\iTop\Service\DependencyInjection\ServiceLocator;
|
||||
use Combodo\iTop\Service\ServiceLocator\ServiceLocatorException;
|
||||
use Combodo\iTop\Service\ServiceLocator\ServiceLocator;
|
||||
use utils;
|
||||
|
||||
/**
|
||||
@@ -61,7 +61,7 @@ class AttributeChoiceFormBlock extends ChoiceFormBlock
|
||||
/**
|
||||
* @inheritdoc
|
||||
*
|
||||
* @throws DIException
|
||||
* @throws ServiceLocationException
|
||||
* @throws FormBlockException
|
||||
* @throws RegisterException
|
||||
*/
|
||||
@@ -89,11 +89,12 @@ class AttributeChoiceFormBlock extends ChoiceFormBlock
|
||||
* @param string|null $sCategory
|
||||
*
|
||||
* @return array
|
||||
* @throws \Combodo\iTop\Service\DependencyInjection\DIException
|
||||
* @throws \Combodo\iTop\Service\ServiceLocator\ServiceLocatorException
|
||||
*/
|
||||
public static function ListAttributeCodesByCategory(string $sClass, string $sCategory = ''): array
|
||||
{
|
||||
$oModelReflection = ServiceLocator::GetInstance()->get('ModelReflection');
|
||||
/** @var \ModelReflection $oModelReflection */
|
||||
$oModelReflection = \MetaModel::GetService('ModelReflection');
|
||||
$aNonGroupableAttributes = [
|
||||
'AttributeLinkedSet',
|
||||
'AttributeFriendlyName',
|
||||
|
||||
@@ -13,7 +13,7 @@ use Combodo\iTop\Forms\IO\Format\AttributeIOFormat;
|
||||
use Combodo\iTop\Forms\IO\Format\ClassIOFormat;
|
||||
use Combodo\iTop\Forms\Register\IORegister;
|
||||
use Combodo\iTop\Forms\Register\OptionsRegister;
|
||||
use Combodo\iTop\Service\DependencyInjection\ServiceLocator;
|
||||
use Combodo\iTop\Service\ServiceLocator\ServiceLocator;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
@@ -58,7 +58,7 @@ class AttributeValueChoiceFormBlock extends ChoiceFormBlock
|
||||
|
||||
try {
|
||||
/** @var \ModelReflection $oModelReflection */
|
||||
$oModelReflection = ServiceLocator::GetInstance()->get('ModelReflection');
|
||||
$oModelReflection = \MetaModel::GetService('ModelReflection');
|
||||
$aValues = $oModelReflection->GetAllowedValues_att($sClass, $sAttCode);
|
||||
|
||||
$oOptionsRegister->SetOption('choices', array_flip($aValues ?? []));
|
||||
|
||||
@@ -36,7 +36,6 @@ class AggregateFunctionFormBlock extends ChoiceFormBlock
|
||||
*
|
||||
* @throws \Combodo\iTop\Forms\Block\FormBlockException
|
||||
* @throws \Combodo\iTop\Forms\Register\RegisterException
|
||||
* @throws \Combodo\iTop\Service\DependencyInjection\DIException
|
||||
*/
|
||||
public function UpdateOptions(OptionsRegister $oOptionsRegister): void
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Combodo\iTop\Forms\Block\DataModel\Dashlet;
|
||||
use Combodo\iTop\Forms\Block\DataModel\AttributeChoiceFormBlock;
|
||||
use Combodo\iTop\Forms\Block\FormBlockException;
|
||||
use Combodo\iTop\Forms\Register\OptionsRegister;
|
||||
use Combodo\iTop\Service\DependencyInjection\ServiceLocator;
|
||||
use Combodo\iTop\Service\ServiceLocator\ServiceLocator;
|
||||
use Dict;
|
||||
use Exception;
|
||||
|
||||
@@ -27,12 +27,13 @@ class ClassAttributeGroupByFormBlock extends AttributeChoiceFormBlock
|
||||
*
|
||||
* @throws \Combodo\iTop\Forms\Block\FormBlockException
|
||||
* @throws \Combodo\iTop\Forms\Register\RegisterException
|
||||
* @throws \Combodo\iTop\Service\DependencyInjection\DIException
|
||||
* @throws \Combodo\iTop\Service\ServiceLocator\ServiceLocatorException
|
||||
*/
|
||||
public function UpdateOptions(OptionsRegister $oOptionsRegister): void
|
||||
{
|
||||
parent::UpdateOptions($oOptionsRegister);
|
||||
$oModelReflection = ServiceLocator::GetInstance()->get('ModelReflection');
|
||||
/** @var \ModelReflection $oModelReflection */
|
||||
$oModelReflection = \MetaModel::GetService('ModelReflection');
|
||||
|
||||
$aGroupBy = [];
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user