diff --git a/src/Controller/LabelController.php b/src/Controller/LabelController.php index 8c0bcca0..90a6715b 100644 --- a/src/Controller/LabelController.php +++ b/src/Controller/LabelController.php @@ -147,7 +147,11 @@ class LabelController extends AbstractController ]); } - if ($form->get('update_profile')->isClicked() && $profile instanceof LabelProfile && $this->isGranted('edit', $profile)) { //@phpstan-ignore-line Phpstan does not recognize the isClicked method + //Check if the current profile should be updated + if ($form->has('update_profile') + && $form->get('update_profile')->isClicked() //@phpstan-ignore-line Phpstan does not recognize the isClicked method + && $profile instanceof LabelProfile + && $this->isGranted('edit', $profile)) { //Update the profile options $profile->setOptions($form_options); diff --git a/templates/label_system/dialog.html.twig b/templates/label_system/dialog.html.twig index 571eb264..037b549e 100644 --- a/templates/label_system/dialog.html.twig +++ b/templates/label_system/dialog.html.twig @@ -100,7 +100,9 @@ {% endif %} - {{ form_row(form.update_profile) }} + {% if form.update_profile is defined %} + {{ form_row(form.update_profile) }} + {% endif %}
diff --git a/tests/API/Endpoints/CurrencyEndpointTest.php b/tests/API/Endpoints/CurrencyEndpointTest.php index 78434ea3..a463daeb 100644 --- a/tests/API/Endpoints/CurrencyEndpointTest.php +++ b/tests/API/Endpoints/CurrencyEndpointTest.php @@ -36,7 +36,7 @@ class CurrencyEndpointTest extends CrudEndpointTestCase { $this->_testGetCollection(); self::assertJsonContains([ - 'hydra:totalItems' => 0, + 'hydra:totalItems' => 4, //The 4 currencies from our fixtures ]); } @@ -45,7 +45,7 @@ class CurrencyEndpointTest extends CrudEndpointTestCase { $this->_testPostItem([ 'name' => 'Test API', - 'iso_code' => 'USD', + 'iso_code' => 'CAD', ]); } @@ -61,4 +61,4 @@ class CurrencyEndpointTest extends CrudEndpointTestCase { $this->_testDeleteItem(5); }*/ -} \ No newline at end of file +}