mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +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
|
bootstrap.php.cache
|
||||||
#the file created by composer to store creds
|
#the file created by composer to store creds
|
||||||
auth.json
|
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
|
//add the custom field group if defined in URL
|
||||||
$cfGroupId = $request->query->get('customFieldsGroup', null);
|
$cfGroupId = $request->query->get('customFieldsGroup', null);
|
||||||
$cfGroup = $this->getDoctrine()->getManager()
|
|
||||||
->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')
|
if ($cfGroupId !== null) {
|
||||||
->find($cfGroupId);
|
$cfGroup = $this->getDoctrine()->getManager()
|
||||||
if (!$cfGroup) {
|
->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')
|
||||||
throw $this->createNotFoundException('CustomFieldsGroup with id '
|
->find($cfGroupId);
|
||||||
. $cfGroupId.' is not found !');
|
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'));
|
$form = $this->createCreateForm($entity, $request->query->get('type'));
|
||||||
|
|
||||||
|
@ -41,9 +41,15 @@
|
|||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
|
{% if entity.customFieldsGroup is not null %}
|
||||||
<a href="{{ path('customfieldsgroup_show', { 'id': entity.customFieldsGroup.id }) }}" class="sc-button btn-reset">
|
<a href="{{ path('customfieldsgroup_show', { 'id': entity.customFieldsGroup.id }) }}" class="sc-button btn-reset">
|
||||||
{{ 'Back to the group'|trans }}
|
{{ 'Back to the group'|trans }}
|
||||||
</a>
|
</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="{{ path('customfieldsgroup') }}" class="sc-button btn-reset">
|
||||||
|
{{ 'Back to the list'|trans }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -100,4 +100,5 @@ class CustomFieldsTextTest extends WebTestCase
|
|||||||
$form = $crawler->selectButton('custom_field_choice_submit')->form();
|
$form = $crawler->selectButton('custom_field_choice_submit')->form();
|
||||||
$this->assertTrue($form->has('custom_field_choice[options][maxLength]'));
|
$this->assertTrue($form->has('custom_field_choice[options][maxLength]'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user