mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
test errors
This commit is contained in:
@@ -48,7 +48,7 @@ class TestController extends AbstractAppController
|
||||
$oAdapter->UpdateFieldsData($data);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_success');
|
||||
return $this->redirectToRoute('app_success', ['data' => $data]);
|
||||
}
|
||||
|
||||
// render view
|
||||
@@ -90,7 +90,7 @@ class TestController extends AbstractAppController
|
||||
$oAdapter->UpdateFieldsData($data);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_success');
|
||||
return $this->redirectToRoute('app_success', ['data' => $data]);
|
||||
}
|
||||
|
||||
$oPage->add_linked_stylesheet(\utils::GetAbsoluteUrlAppRoot() . 'css/form-sdk/form.css');
|
||||
@@ -202,8 +202,8 @@ class TestController extends AbstractAppController
|
||||
}
|
||||
|
||||
#[Route('/success', name: 'app_success')]
|
||||
public function Success(): Response
|
||||
public function Success(Request $oRequest): Response
|
||||
{
|
||||
return $this->render('formSDK/success.html.twig');
|
||||
return $this->render('formSDK/success.html.twig', ['data' => $oRequest->get('data')]);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ use Combodo\iTop\FormSDK\Service\FormFactory;
|
||||
use Combodo\iTop\FormSDK\Service\FormManager;
|
||||
use DateTime;
|
||||
use MetaModel;
|
||||
use Symfony\Bundle\FrameworkBundle\Routing\Router;
|
||||
use Symfony\Component\PropertyAccess\PropertyAccess;
|
||||
use Symfony\Component\Routing\RouterInterface;
|
||||
use Symfony\Component\Validator\Constraints\Length;
|
||||
@@ -40,7 +41,7 @@ class FormHelper
|
||||
'group' => true,
|
||||
'layout' => false,
|
||||
'object_only' => true,
|
||||
'object_count' => 1
|
||||
'object_count' => 10
|
||||
]
|
||||
];
|
||||
|
||||
@@ -64,7 +65,7 @@ class FormHelper
|
||||
// form data
|
||||
$aData = [
|
||||
'city' => 'Autun',
|
||||
'tel' => '+33(6) 35 57 48 77',
|
||||
'tel' => '+33(0)6 35 57 48 77',
|
||||
'birthday' => new DateTime('1979/06/27'),
|
||||
'count' => 10,
|
||||
'counts' => ['count1' => 10, 'count2' => 20, 'count3' => 30],
|
||||
@@ -119,7 +120,7 @@ class FormHelper
|
||||
// tel - text with pattern
|
||||
$oFormFactory->AddTextField('tel', [
|
||||
'label' => 'Tel',
|
||||
'constraints' => new Regex(['pattern' => '/\+33\(\d\) \d\d \d\d \d\d \d\d/'], null, '+{33}(0) 00 00 00 00'),
|
||||
'constraints' => new Regex(['pattern' => '/\+33\(\d\)\d \d\d \d\d \d\d \d\d/'], null, '+{33}(0)0 00 00 00 00'),
|
||||
'required' => false
|
||||
]);
|
||||
|
||||
@@ -203,7 +204,7 @@ class FormHelper
|
||||
'required' => false,
|
||||
|
||||
], [
|
||||
'url' => 'http://localhost'.$oRouter->generate('formSDK_ajax_select'),
|
||||
'url' => $oRouter->generate('formSDK_ajax_select', [], Router::NETWORK_PATH),
|
||||
'query_parameter' => 'query',
|
||||
'value_field' => 'breed',
|
||||
'label_field' => 'breed',
|
||||
|
||||
@@ -92,7 +92,7 @@ final class FormFactoryObjectAdapter implements FormFactoryAdapterInterface
|
||||
// compute label
|
||||
$sLabel = $oAttributeDefinition->GetLabel();
|
||||
if(!$this->bGroup){
|
||||
$sLabel = $this->GetLabel() . ' ••• ' . $sLabel;
|
||||
$sLabel = $this->GetAdapterIdentifier() . ' - ' . $sLabel;
|
||||
}
|
||||
|
||||
// attribute options
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace Combodo\iTop\FormSDK\Service;
|
||||
|
||||
use Combodo\iTop\FormSDK\Field\FormFieldDescription;
|
||||
use Combodo\iTop\FormSDK\Field\FormFieldTypeEnumeration;
|
||||
use Symfony\Bundle\FrameworkBundle\Routing\Router;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Validator\Constraints\Regex;
|
||||
|
||||
/**
|
||||
@@ -222,7 +224,7 @@ trait FormFactoryBuilderTrait
|
||||
'oql' => $sOql,
|
||||
'fields' => '{'.implode($aAttributesToLoad).'}',
|
||||
];
|
||||
$sUrl = 'http://localhost' . $this->oRouter->generate('formSDK_object_search') . '?' . http_build_query($aAjaxData);
|
||||
$sUrl = $this->oRouter->generate('formSDK_object_search', [], UrlGeneratorInterface::ABSOLUTE_URL) . '?' . http_build_query($aAjaxData);
|
||||
$aAjaxOptions = [
|
||||
'url' => $sUrl,
|
||||
'query_parameter' => 'search',
|
||||
@@ -232,6 +234,7 @@ trait FormFactoryBuilderTrait
|
||||
'threshold' => $iAjaxThreshold,
|
||||
'configuration' => 'OQL'
|
||||
];
|
||||
|
||||
return $this->AddSelectAjaxField($sKey, $aOptions, $aAjaxOptions, $aAjaxData);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
<h2>Success</h2>
|
||||
|
||||
<p>{{ dump(data) }}</p>
|
||||
|
||||
|
||||
{% endblock body %}
|
||||
Reference in New Issue
Block a user