mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix creation of custom field without cfgroup id
This commit is contained in:
parent
2401270754
commit
c9ca7c1e1b
2
.gitignore
vendored
2
.gitignore
vendored
@ -28,3 +28,5 @@ src/Chill/CustomFieldsBundle/vendor/*
|
||||
bootstrap.php.cache
|
||||
#the file created by composer to store creds
|
||||
auth.json
|
||||
Tests/Fixtures/App/app/config/parameters.yml
|
||||
|
||||
|
@ -76,14 +76,17 @@ class CustomFieldController extends Controller
|
||||
|
||||
//add the custom field group if defined in URL
|
||||
$cfGroupId = $request->query->get('customFieldsGroup', null);
|
||||
$cfGroup = $this->getDoctrine()->getManager()
|
||||
->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')
|
||||
->find($cfGroupId);
|
||||
if (!$cfGroup) {
|
||||
throw $this->createNotFoundException('CustomFieldsGroup with id '
|
||||
. $cfGroupId.' is not found !');
|
||||
|
||||
if ($cfGroupId !== null) {
|
||||
$cfGroup = $this->getDoctrine()->getManager()
|
||||
->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')
|
||||
->find($cfGroupId);
|
||||
if (!$cfGroup) {
|
||||
throw $this->createNotFoundException('CustomFieldsGroup with id '
|
||||
. $cfGroupId.' is not found !');
|
||||
}
|
||||
$entity->setCustomFieldsGroup($cfGroup);
|
||||
}
|
||||
$entity->setCustomFieldsGroup($cfGroup);
|
||||
|
||||
$form = $this->createCreateForm($entity, $request->query->get('type'));
|
||||
|
||||
|
@ -41,9 +41,15 @@
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
{% if entity.customFieldsGroup is not null %}
|
||||
<a href="{{ path('customfieldsgroup_show', { 'id': entity.customFieldsGroup.id }) }}" class="sc-button btn-reset">
|
||||
{{ 'Back to the group'|trans }}
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{{ path('customfieldsgroup') }}" class="sc-button btn-reset">
|
||||
{{ 'Back to the list'|trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
@ -100,4 +100,5 @@ class CustomFieldsTextTest extends WebTestCase
|
||||
$form = $crawler->selectButton('custom_field_choice_submit')->form();
|
||||
$this->assertTrue($form->has('custom_field_choice[options][maxLength]'));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user